Testing php mail() in localhost problem

Posted by Samir Ghobril on Server Fault See other posts from Server Fault or by Samir Ghobril
Published on 2011-02-15T14:47:51Z Indexed on 2012/04/07 17:34 UTC
Read the original article Hit count: 297

Filed under:
|
|

Hey guys, recently I just installed msmtp in linux and I even send a mail from the terminal and it worked:

echo -e "Subject: Test Mail\r\n\r\nThis is a test mail" |msmtp --debug --from=default -t [email protected]

But in php, after editing the php.ini file to have this:

sendmail_path = '/usr/bin/msmtp -t'

and using this piece of code:

<?php
if ( mail ( '[email protected]', 'Test mail from localhost', 'Working Fine.' ) ){
echo 'Mail sent';
}
else{
echo 'Error. Please check error log.';
}

?>

I get the Mail sent message but don't receive a message in my inbox. Not even in the spam folder. Anything wrong I'm doing?

msmtp configuration file:

defaults
tls on
tls_starttls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt

account default
host smtp.gmail.com
port 587
auth on user [email protected]
password password
from [email protected]
logfile /var/log/msmtp.log

© Server Fault or respective owner

Related posts about php

Related posts about sendmail