My server don't have 'postfix' to send mails from 'sendmail'.
Instead, I use 'msmtp' and 's-nail' shell commands.
It works well from interactive shell ('bash').
I try to send mail from PHP, but I don't receive any, and have no output nor error:
<?php
$mess = 'foobar';
$to = '[email protected]';
$subject = 'test';
//mail($to,$subject,$mess); doesn't work
$out = system("echo $mess | /usr/bin/s-nail -v -s $subject $to");
echo $out;
?>
Any help?
If I run the script like this :
# php script.php
it works.
But when called from web, it doesn't work
Found the solution there: https://wiki.archlinux.org/title/Msmtp#Miscellaneous
In 'php.ini':
In
/etc/mail.rc:In PHP script, now
mail()run properly.If you have the package
msmtp-mtalike Debian/Ubuntu, things are more simple. It enable port 25 to listen on localhost as aMTA