Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

PHP to send mail through google smtp

Posted on 2013-02-02
3
Medium Priority
?
447 Views
Last Modified: 2013-02-06
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,
sample
0
Comment
Question by:tf2012
3 Comments
 
LVL 84

Accepted Solution

by:
Dave Baldwin earned 1000 total points
ID: 38847005
PHPMailer has demo code that works with Gmail.  http://code.google.com/a/apache-extras.org/p/phpmailer/wiki/PHPMailer
0
 
LVL 9

Assisted Solution

by:rinfo
rinfo earned 1000 total points
ID: 38848352
why you have mentioned both the server address for smtp server
$SmtpServer="ssl://mail.xyzwebsite.com";//smtp.gmail.com
As far as i know if the smtpuser and smtppass are valid gmail account it would work with just smtp.gmail.com and smtp port would be 587.
0
 
LVL 1

Author Closing Comment

by:tf2012
ID: 38861710
switched over to different mail server but thanks anyway!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days socially coordinated efforts have turned into a critical requirement for enterprises.
It’s a season to be thankful, and we’re thankful for users like you who engage on site, solve technology problems, and network with others in the industry. What tech are we most thankful for? Keep reading.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question