Written by Giles Bennett
UPDATED (25/01/15)
A change in Magento 1.9.1.0 means that the new order emails are now not sent upon the processing of the order (as they used to be) but instead sent via a cron job. If you've followed the information in this post and all other emails, other than new order emails, are being sent properly, then the next thing to do is check that your cron job is set up and running properly.
ORIGINAL POSTFrequently I'll get people getting in touch with me because their Magento installation isn't sending emails (or has suddenly stopped sending emails). It can be for any number of reasons, but before doing anything else there are two quick tests to check - is mail() (the PHP function that Magento uses to send emails by default) enabled in the first place, and secondly, is it sending emails.
Both of these checks can be done outside Magento. For the former, it just requires a very simple script (download it below) which checks to see if mail() is enabled on the server - it's frequently not enabled for security reasons, because if hijacked it can be used to send large quantities of spam email very quickly.
The following script very simply checks if mail() is enabled on the server, and tells you :
To run it, create it as a file, upload it to the web root of your site as mail.php, then visit
https://www.yoursite.com/mail.php
in a browser to see the output.
If mail() isn't enabled, then you'll have to liaise with your hosts to get it turned on, or alternatively set up Magento to use a separate mail server to send its emails through.
If mail() is enabled, but Magento's not sending emails, then the next step is to send a test email from the server, not from Magento. Again, this can be done very simply using a script along the lines below.
Simply create it as a file, change the 'to' and 'from' addresses, and then upload it to your server as test-email.php (or similar) and visit https://www.yoursite.com/test-email.php in a browser. If it reports that the message has been sent successfully, then you should receive the test email at the 'to' address relatively shortly thereafter. If it is, then it's indicative that the error lies with your Magento installation or its configuration, and not with your server configuration.
If, however, it reports that the message has been sent successfully but it doesn't make it to the 'to' email address, then the first thing to check is that it's not in the spam bin (which is a topic for a whole 'nother post). If it's not, then it's almost certain that the error lies somewhere in your server configuration...so at least you now know where best to start looking!