It takes ~60 seconds to send a single email

February 14, 2014 4.7k views
I have a WordPress droplet and everytime PHP sends an email, it takes about 60 seconds to load the page. For example, when you click "Send" on the contact form, it takes a whole minute for the "Sent Successfully" message to show up. When running "ps wwaux | egrep "postfix|mail|exim"", i get: ps wwaux | egrep "postfix|mail|exim" root 886 0.0 0.2 102176 2668 ? Ss Jan22 1:27 sendmail: MTA: accepting connections root 15032 0.0 0.0 9392 896 pts/0 S+ 17:17 0:00 egrep --color=a uto postfix|mail|exim
3 Answers
Wow this actually worked, that's amazing.

How did you know this would solve it?

What do you do if you have multiple virtualhosts with different domains on the same server?

  • You should use the hostname that appears in the error in sendmail's log file:

    sudo tail /var/log/mail.log
    

    For example, if the error log looks like this:

    Jul 31 09:52:42 piotr-probook sendmail[2912]: My unqualified host name (piotr-probook) unknown; sleeping for retry
    

    The hostname would be piotr-probook.

Have another answer? Share your knowledge.