I have a weird problem. Using the mail() function and a local Postfix on the server. When Postfix is running, mail gets sent just fine but if I stop Postfix mail() still returns true but no e-mails are obviously sent and no error gets logged anywhere.
Code for sending:
echo $accepted; //Returns 0
$accepted = mail($to, $subject, $message, $headers);
echo $accepted; //Returns 1
No other MTAs are running at the server.
Is there any good way of debugging this?
While Postfix may not be running, the mail is still successfully enqueued for sending - on the next start of Postfix it will be processed and sent.
PHP's (internal) sendmail
call has no way to know, if the MTA is running - just if queueing the mail worked or not.