photo credit: Debarshi Ray via photopin cc

Test if e-mails are working in Magento

Tags: , ,

Have you ever been in the situation where you need to quickly check if your Magento-site is still sending e-mails? You know you can just send a mail by using PHP’s mail()-command, but of course, you need to check if Magento is able to send e-mails. After all, you never know how Magento’s internal e-mail settings are configured, so it’s best to send a mail the Magento-way.

So I wrote this little script that you can place in the root of your site:

Save it in a file called mailtest.php, and simply call it in the browser like this:

Now you should see a true -message when Magento was able to send the mail and false  if not. Please note that ‘true’ means that in the very end, PHP was able to send the mail. So if the mail is not arrived the problem lies somewhere else (spamfilter? SPF records? who knows…), but not with Magento.


Visitors give this article an average rating of 4.6 out of 5.

How would you rate this article?

10 thoughts on “Test if e-mails are working in Magento”

  1. Stan says:

    Very handy script thanks!

  2. stacy says:

    I’ve been having no end of troubles with magento emails…
    If i run this script it’s returning true, and turning up in my mail-
    but when i try to send order emails nothing…
    have cron setup, scheduler working away, but the kicker is even pressing the “send email” button on a previous order does not result in any emails sent –

    It’s my understanding no cron is required for those emails send from a sales order screen like that-

  3. zeki893 says:

    i got the same problem. the script returns true and e-mail is received, but any magento created by magento aren’t working.

  4. faraz says:

    i got bool(false) how to resolve it. any help /suggestion please Thanks

  5. Francis Kim says:

    Nice script, thanks!

  6. Tony Randall says:

    I am having email issues with magento. However, when I use this script and put it in the public_html folder of the server, magento redirects to a 404 page. Can anybody please help and let me know how to stop the redirect to the 404 page? Thanks

  7. celano says:

    i got bool(true) and e-mail is received.

    But how can i solve this magento issue

    2016-02-25T11:59:14+00:00 ERR (3):
    exception ‘Zend_Mail_Transport_Exception’ with message ‘Missing To header’ in /lib/Zend/Mail/Transport/Sendmail.php:182

    any solution for this?

  8. Hung says:

    What to do next if it returns “bool(false)”?

  9. Amazing solution@ Thanks a lot

  10. Marry says:

    it returns “bool(false)” What to do next?

Leave a Reply