Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using the PHP mail() function to send emails from a Linux server, but using Exchange as the main MTA. To achieve this sendmail has been set up to relay everything to the local Exchange server, which then sends the emails out.

This is working correctly, but the PHP script seems to wait until the timeout limit before finishing. I thought perhaps it's waiting for a response from sendmail, which doesn't come becomes it's just a relay?

I specified the php.ini command line option for "sendmail_path" -odb, which should start sendmail with the "background" delivery mode, meaning to fire off emails in a separate process and then immediately return. But it still takes 30 seconds for the PHP script to end.

Anyone have any ideas? I'm a bit stumped. Thanks.

share|improve this question
up vote 0 down vote accepted

Can you install the mailx package and see if you get the same delay when using the mail command?

echo foo | mail

If that is the case then you know it is a sendmail issue, which is often because you need to set up the host + domain name on the machine.

share|improve this answer
Also check the mail logs in /var/log – Kyle Brandt Sep 14 '09 at 15:16
Thanks for your help, it was a sendmail issue. I was getting a "my unqualified hostname (hostname) unknown" error in /var/log/maillog. It was solved by adding the hostname to /etc/hosts. Now it's instant! – me_here Sep 14 '09 at 15:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.