Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Thu Jun 27, 2013 1:01 am 
Offline
Junior Member

Joined: Mon Apr 11, 2011 9:49 pm
Posts: 49
mail() test with PHP:
<?php
$to = 'email@domain.com';
$subject = 'Test email using PHP';
$message = 'This is a test email message';
$headers = 'From: php-daemon@domain.com' . "\r\n" .
'Reply-To: php-daemon@domain.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
if(mail($to, $subject, $message, $headers, '-femail@domain.com'))
echo 'Successfully sent email to queue.';
else
echo 'Error, mail was not sent to queue.';
?>

Returns:
Successfully sent email to queue.

tail -f /var/log/maillog:
Jun 26 21:32:38 sr2 postfix/smtp[5121]: connect to ASPMX2.GOOGLEMAIL.COM[74.125.142.27]:25: Connection timed out

Jun 26 21:32:38 sr2 postfix/smtp[5121]: 9307840CEF: to=<email@domain.com>, relay=none, delay=790, delays=640/0.01/150/0, dsn=4.4.1, status=deferred (connect to ASPMX2.GOOGLEMAIL.COM[74.125.142.27]:25: Connection timed out)

Jun 26 21:32:38 sr2 postfix/smtp[5122]: connect to alt4.gmail-smtp-in.l.google.com[74.125.131.26]:25: Connection timed out

How do I force it to use port 587?


Top
   
PostPosted: Thu Jun 27, 2013 3:42 am 
Offline
Senior Member
User avatar

Joined: Sun Jan 18, 2009 2:41 pm
Posts: 830
Include ":587" at the end of the relayhost configuration setting.

This howto gives a relatively straightforward explanation of sending outbound mail via Gmail. You can probably find others out there that are specific to your distro and version.


Top
   
PostPosted: Wed Jul 03, 2013 1:28 pm 
Offline
Junior Member

Joined: Mon Apr 11, 2011 9:49 pm
Posts: 49
Worked. Even with unauthenticated sender emails. I did have to turn off sendmail, and turn on postfix.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group