Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-02-2012, 05:24 AM   PM User | #1
shaunthomson
New Coder

 
Join Date: May 2012
Posts: 88
Thanks: 51
Thanked 0 Times in 0 Posts
shaunthomson is an unknown quantity at this point
mail problem cc'ing

Gidday

I send a set up email when someone registers on my site. I also cc this email to support@mysite.com so I can monitor registrations to check for spam.

The email goes through to the user just fine, but I'm not getting cc'd on it anymore (it was working fine a while ago, and I can't recall changing the mail set up at all).

It's using Pear and Gmail.

Can anyone see a problem in the code?

PHP Code:
$base "mysite.com";

require_once 
"Mail.php";

$subject "blah";
$body "blah blah";
$from "support@".$base;
$to "$email";
$cc "support@".$base;
$recipients $to.", ".$cc;

$host "ssl://smtp.gmail.com";
$port "465";
$username "bladiblah";//google apps username
$password "blahdiblahblah";//google apps pass

$headers = array ('From' => $from,
  
'To' => $to,
  
'Subject' => $subject,
  
'Cc' => $cc);
$smtp Mail::factory('smtp',
  array (
'host' => $host,
    
'port' => $port,
    
'auth' => true,
    
'username' => $username,
    
'password' => $password));

$mail $smtp->send($recipients$headers$body);

if (
PEAR::isError($mail))
{                        
    
//error stuff
}                
else
{
    
//success!!!

Thanks for taking a look.
shaunthomson is offline   Reply With Quote
Old 11-02-2012, 01:03 PM   PM User | #2
tangoforce
Senior Coder

 
tangoforce's Avatar
 
Join Date: Feb 2011
Location: Your Monitor
Posts: 3,493
Thanks: 44
Thanked 438 Times in 427 Posts
tangoforce will become famous soon enoughtangoforce will become famous soon enough
To be honest if it just suddenly stopped working then its more likely to be a spam filter on your server that has got fed up with emails using the same template and decided they must all be spam.

There is no other reason for them not to be arriving if you've not touched the code.

To be safe, you could always try using phpmailer but i don't think you're going to see any change in the outcome.
__________________
Please wrap your code in [php] tags. It is a sticky topic and it HELPS us to HELP YOU!
TIP: Coding styles and $end errors :::::::::: TIP: Warning: Cannot modify header information - headers already sent :::::::::: TIP: Quotes / Parse error: syntax error, unexpected T_..
PHP Code:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value. 
Explanation: The IE if(isset($_POST['submit'])) bug explained.
tangoforce is offline   Reply With Quote
Users who have thanked tangoforce for this post:
shaunthomson (11-05-2012)
Old 11-05-2012, 02:36 AM   PM User | #3
shaunthomson
New Coder

 
Join Date: May 2012
Posts: 88
Thanks: 51
Thanked 0 Times in 0 Posts
shaunthomson is an unknown quantity at this point
Turns out it's something Google changed in Google Apps. If you send an email to yourself, it skips the inbox and goes straight to sent.

The best you can do to get around it is set up a new contact in CONTACTS, set it to the email that you are cc'ing yourself on (the one with the same domain as your account email), and then it gets sent to your main account email address, although it shows up as being read (not bold in my email program). I set up a filter for the cc email addy so that it gets a star, to try and make it stand out a little since it's delivered as read.
shaunthomson is offline   Reply With Quote
Reply

Bookmarks

Tags
mail

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:51 PM.


Advertisement
Log in to turn off these ads.