First off it’s always a good idea to queue your email messages in your application then process them separately with a regular cron job etc. This improves the user experience by cutting the waiting for the mail process to send and allows you to attempt to resend if an error occurs.
Check your mail log file while trying to send an email to see what is going on:
tail -f /var/log/mail.log
If you see a message like “unqualified host name (localhost) unknown; sleeping for retry” then you’ll need to make sure your host name is added to the /etc/hosts file so that it looks something like:
127.0.0.1 localhost.localdomain localhost yourhostname
Re-test and enjoy faster email sending!