A Magento website I'm maintaining stopped sending order confirmations and/or invoices all of a sudden.
Nothing has been changed in the email settings and they're all complying with common Magento guidelines. I've tried sending a test email through the following php script to make sure it's not caused by any server settings:
<?php
$to = "[email protected]";
$subject = "Test email";
$message = "This is a test email.";
$from = "[email protected]";
$headers = "From:" . $from;
if (mail($to, $subject, $message, $headers)) {
echo("Your message has been sent successfully");
} else {
echo("Sorry, your message could not be sent");
}
?>
The test message got delivered flawlessly.
I installed the SMTP Pro Email plugin to see if changing settings there would manage a result; nothing. The plugin offers the ability to send a test email, which again gets delivered without flaw.
Even stranger, clicking the 'Send Email' button in the Magento backend for an order does deliver the email. Signing up for a newsletter does result in a subscription confirmation request email. Clearly, the website can send mails, it just somehow doesn't get triggered to do so for order order confirmations and invoices.
And yes, both
System > Configuration > Sales > Sales Emails > Order > Enabled
and
System > Configuration > Sales > Sales Emails > Invoice > Enabled
are set to Yes and include a BCC address.
Similarly,
System > Configuration > Advanced > System > Mail Sending Settings > Disable Email Communications
is set to No.
I'm running Magento CE 1.6.2 on this site, so it's not the common cron job problem version 1.9 seems to cause for a lot of folk.
I'm racking my brain here, does anybody have a clue?
Still haven't found what causes the problem, but added some code to succes.phtml to force the mail to be sent upon loading that page:
It's not the most elegant solution, but at least the customers get their order confirmation through this workaround.