Solved

PHP to send mail through google smtp

Posted on 2013-02-02
3
441 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 83

Accepted Solution

by:
Dave Baldwin earned 250 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 250 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

Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Help in good tutorials for PHP, HTML and CSS 6 40
What's wrong with this PDO query? 5 27
php help 34 58
ajax to record click 3 16
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
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…

860 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