Solved

PHP to send mail through google smtp

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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

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

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

911 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now