Answer the question
In order to leave comments, you need to log in
Why might mail() not work?
Why might the php mail() function not work?
server on centos, msmtp installed, exchange mail server, PHP 5.6.33
when sent from console with
echo "Testing" | mail -s "Test" [email protected]
php -r "mail('[email protected]', 'Test', 'Test');"
both letters reach, when sending from the site, nothing is written to the log;
verification of sending from the site is performed by such a file
$sender = '[email protected]';
$recipient = '[email protected]';
$subject = "php mail test";
$message = "php test message";
$headers = 'From:' . $sender;
if (mail($recipient, $subject, $message, $headers))
{
echo "Message accepted";
}
else
{
echo "Error: Message not accepted";
}
Answer the question
In order to leave comments, you need to log in
I'm dumb.
due to the fact that the site runs under the apache user, and I made the config under root,
you need to override sendmail_path = msmtp -C /home/msmtp/.msmtprc -t -i
copy the finished config /root/.msmtprc to /home/msmtp/. msmtprc and make the file owned by apache with permissions 600
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question