A Fix For Slow Sendmail [Linux, PHP]

Recently I have noticed that one of my PHP scripts that was sending emails via the mail() function were hanging for roughly one minute while waiting for Sendmail to work.

The problem was that Sendmail requires that the result of "hostname" be a fully qualified domain name to start cleanly.

To get the domain name type hostname command and then copy it to /etc/hosts like this: kiril-macbook.localdomain kiril-macbook localdev localhost
Fork me on GitHub