Link to home
Start Free TrialLog in
Avatar of tf2012
tf2012

asked on

PHP to send mail through google smtp

Hi,

I'm trying to get a contact form mailing through some php code.  The code works when I point it at a different mail server but when I point it at the production domain smtp address is doesn't work.

No errors, just no mail received.

the domain is hosted with a 3rd party domain host.  The webserver has a series of MX record entries as shown in the attached image.  

Here are the PHP smtp setting I used, unsuccesfully.  Again, the code works because when I point it to a different mail server everything works fine.

<?php
//Server Address
$SmtpServer="ssl://mail.xyzwebsite.com";//smtp.gmail.com
$SmtpPort="465";
$SmtpUser="fake@xyzwebsite.com";
$SmtpPass="123pass456";

?>

After trying it with no ssl, port 25, 26, and 587 without success I tried the ssl preamble.  Still no success.  Address & login work and are actual functioning google mail accounts under a google apps account.  The google accounts stuff works on the google side.  When I send an email from a 3rd party address to the google account address it's received fine showing that the dns & mx records are routing properly.  

I just can't push mail through with these params.

Can someone tell me what they think may be necessary to establish a successful connection to the google mail server?

Thanks,
User generated image
ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tf2012
tf2012

ASKER

switched over to different mail server but thanks anyway!