Linode Forum
https://forum.linode.com/

Sendmail wont work with PHP
https://forum.linode.com/viewtopic.php?f=11&t=10188
Page 1 of 1

Author:  superfastcars [ Thu Jun 27, 2013 1:01 am ]
Post subject:  Sendmail wont work with PHP

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?

Author:  Vance [ Thu Jun 27, 2013 3:42 am ]
Post subject:  Re: Sendmail wont work with PHP

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.

Author:  superfastcars [ Wed Jul 03, 2013 1:28 pm ]
Post subject:  Re: Sendmail wont work with PHP

Worked. Even with unauthenticated sender emails. I did have to turn off sendmail, and turn on postfix.

Page 1 of 1 All times are UTC-04:00
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/