Quick fix for really slow PHP mail()

To fix painfully slow PHP mail function (you are also probably getting lots of

unable to qualify my own domain name

errors in /var/log/mail.log), make sure that both localhost and localhost.localdomain are in your /etc/hosts file: localhost localhost.localdomain

Also add localhost.localdomain as new line to /etc/mail/local-host-names file.

As the last step, restart sendmail:

service sendmail restart

You can quickly test by running:

mail -s "Test Email" your@email < /dev/null

Comments are closed.