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 running Ubuntu 9.10 LAMP and trying to do a simple email test with PHP and I'm not getting any emails sent.

mail("", "eric-linux test", "test") or die("can't send mail"); 

I get no errors from PHP when running that script.

In my php.ini file is:

sendmail_path = /usr/lib/sendmail -t -i

$ sudo ps aux | grep sendmail
eric      2486  0.0  0.4   8368  2344 pts/0    T    14:52   0:00 sendmail -s “Hello world”
eric      8747  0.0  0.3   5692  1616 pts/2    T    16:18   0:00 sendmail
eric      8749  0.0  0.3   5692  1636 pts/2    T    16:18   0:00 sendmail start
eric      9190  0.0  0.3   5692  1636 pts/2    T    19:12   0:00 sendmail start
eric      9192  0.0  0.3   5692  1616 pts/2    T    19:12   0:00 sendmail
eric      9425  0.0  0.3   5692  1620 pts/1    T    19:37   0:00 sendmail
eric      9427  0.0  0.3   6584  1636 pts/1    T    19:37   0:00 sendmail restart
eric      9429  0.0  0.3   5692  1636 pts/1    T    19:38   0:00 /usr/lib/sendmail restart
eric      9432  0.0  0.1   3040   804 pts/1    R+   19:38   0:00 grep --color=auto sendmail

When I run $ sendmail start it just hangs there doing nothing. I installed postfix also to see if it would help, but it didn't.

I tried to see port 25:

eric@eric-linux:~$ telnet localhost 25
Trying ::1...
Connected to localhost.
Escape character is '^]'.
220 eric-linux ESMTP Postfix (Ubuntu)


share|improve this question

migrated from Mar 1 '10 at 5:38

This question came from our site for professional and enthusiast programmers.

do you really need a full mta installed? i never use sendmail and only have 1 postfix install for all my servers. in all others i use ssmtp. much simpler to configure and more efficient to use, if your server doesn't need to receive emails.

share|improve this answer

try to "strace" sendmail to understand why it blocks.

try also to configure it to use a smart host (e.g. your internal network mail relay server, ask sysadmins):

yum|apt-get install sendmail-cf

vim /etc/mail/ 



define(`SMART_HOST',`localhost')    <-- to enforce sendmail to use your postfix

note that in this strange syntax

dnl define(`SMART_HOST',`smtpserver.tld')

is a commented line!!! so get rid of dnl if you found on the smart_host default line

build the conf

m4 >

service sendmail restart

test it:

sendmail -s "Test"
share|improve this answer

try the examples in the docs instead. If it works, most probably you forgot to pass additional info to mail(). Otherwise, the area to look for would be your sendmail configuration.

share|improve this answer
It seems I'm getting the emails, but they come in very slowly around 10-15 minutes later. When I run the simple mail function in PHP the page hangs there for around 30 seconds until completely finished loading. Also, I should mention, I'm using an old computer with 500MB of Ram. Do you think that could be the problem? In my email client it shows the From address as "www-data <www-data@eric-linux>" thanks – user36428 Mar 2 '10 at 0:50
It looks like DNS timeouts. Check that you have your hostnames resolvable via DNS or in /etc/hosts. – Mircea Vutcovici Mar 29 '10 at 16:40

Have you checked the firewall? I had been pulling my hair to fix such a problem after configuring a strict firewall blocking all input & output ports except the ones being used by daemons.

share|improve this answer

Your Answer


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