Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

The mail() function in php works strange these days.

mail("", "Subject", "Content");

The above script works if I use "php script.php" in command line. However, if I link to the page( by browser, the mail will not be sent even if the mail function returns true.

I googled about it and find a solution. It says "modify the php.ini file as following".


sendmail_path = "/usr/sbin/sendmail -t -i"


sendmail_path = "/usr/sbin/sendmail -t"

And it works for me right now. Does anyone know why removing parameter -i can solve the problem? it goes well with -i in the past few months!!

share|improve this question

From the sendmail manual page:

-i Ignore dots alone on lines by themselves in incoming messages. This should be set if you are reading data from a file.

So it may depend on how the content is formatted, or how mail() internally decides to read the content and then feed it to sendmail (were previous versions of mail() writing the content string in a temporary file and then calling sendmail?).

share|improve this answer
I'm curious about why typing in the command(php script.php) is different from retrieve from apache( – benck Sep 26 '11 at 6:00
When you issue -i, sendmail waits for end-of-file. – adamo Sep 26 '11 at 6:29

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.