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:

127.0.0.1 kiril-macbook.localdomain kiril-macbook localdev localhost