I made a small test php script that sends an email like this:
$headers = 'From: ' . $_POST["from"];
if (mail ($_POST["to"], $_POST["subject"], $_POST["body"], $headers)) {
echo "Mail sent";
} else {
echo "Problem sending email";
}
This is working fine on a server with Postfix.
When trying with msmtp, it ignores the From and complains:
msmtp: account default from /etc/msmtprc: envelope-from address is missing
The content of the config file is:
# cat /etc/msmtprc
account default
host localhost
port 25
I tried to set a from in that file and it worked, but overwritted the From that I passed in php.
Thanks for your help