For some reason mail()
function fails when we try to send emails, I debugged the Magento base code and I found that it generates a call to mail function like this:
$result = mail('[email protected]', 'My Test Message', "I'm sending a test message", $header, '-f');
I tested this in a simple PHP page and in fact it doesn't work, that's weird because I debugged the same Magento code in our old server and the call is the same and there the mail function works as expected.
In order to make it work I tried to remove the last parameter and then the email is sent
$result = mail('[email protected]', 'My Test Message', "I'm sending a test message", $header);
and also I tested the next and the email is sent too
$result = mail('[email protected]', 'My Test Message', "I'm sending a test message", $header, '-f [email protected]');
So I don't know why the magento call is not working, I think it's related to the server configuration or PHP configuration because the same call works as expected in our old server, but I'm not sure.
Our old server was Windows Server and now we're over Ubuntu server and my PHP v5.5.9.
UPDATE I received information from one of the technical guy and now I know that the server is using postfix to send emails. This is a log that I received:
Jun 17 15:39:58 web01 postfix/sendmail[21502]: fatal: usage: sendmail [options]
Jun 17 15:41:07 web01 postfix/sendmail[21697]: fatal: usage: sendmail [options]