PEAR Mail sends through gmail to any email account...except

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
emmitt2299
Forum Newbie
Posts: 1
Joined: Wed Jan 05, 2011 5:15 pm

PEAR Mail sends through gmail to any email account...except

Post by emmitt2299 »

PEAR Mail sends through gmail to any email account.... except any domain on the same VPS.

Here's what I mean.

I have 6 domains hosted on the same VPS. All of my domains except 1 use gmail as its mail server.

When I send an email through Pear Mail, I send it THROUGH gmail's smtp server. Here's the code I use for that:

Code:

Code: Select all

                $sendtoemail = 'blah@gmail.com'; 
      $host = "ssl://smtp.googlemail.com"; 
                $port = "485"; 
                $username = "xxxxxxx@stepstonere.com"; 
                $password = "xxxxxxxxx"; 
      $crlf = "\n"; 
      $hdrs = array( 
                    'From'    => 'xxxxxxx@stepstonere.com', 
               'CC' => 'dan@stepstonere.com', 
                    'Subject' => 'A new note for potential client, '.$fname.' '.$lname.' ', 
                
                    ); 

            $mime = new Mail_mime($crlf); 

            $mime->setTXTBody($text); 
             
                           $body = $mime->get(); 
                           $hdrs = $mime->headers($hdrs); 

            $mail =& Mail::factory('mail', 
      array ('host' => $host, 
                    'port' => $port, 
                    'auth' => true, 
                    'username' => $username, 
                    'password' => $password)); 
             $mail->send($sendtoemail, $hdrs, $body) 

;


The email is received IF one of the following are true:
1. if the "$sendtoemail" variable contains an email address that is on my VPS, but does NOT use googlemail as its mail server (instead uses the VPS mail server)
2. If the "$sendtoemail" variable contains an email address NOT on my VPS, including an independent gmail account.

The email is NOT received IF:
-- the $sendtoemail variable contains an email address ON the VPS AND that domain uses googlemail as its mail server, even when its a different domain from the one that sends.

It is NOT putting into junkmail.... its like its just not being received at all. Any ideas what could be causing this?

If you help, I promise to give you +2 good lucks. Thanks!
Phoenixheart
Forum Contributor
Posts: 123
Joined: Tue Nov 16, 2004 7:46 am
Contact:

Re: PEAR Mail sends through gmail to any email account...exc

Post by Phoenixheart »

Looks like you'll need to check the (network) configuration of the VPS, this doesn't sound like a PHP problem.
Post Reply