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

i just figured out that the mail() function isn't working

i'm under Debian, i installed postfix because a friend told me to (although i didn't configure it).

When i do a phpinfo() i've got :

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

but in this directories i don't have anything like sendmail

Do you have an idea, on what i should do to get mail() working ?

Thank you

share|improve this question
up vote 2 down vote accepted

In Unix, most programs rely on a MTA (message transfer agent) to do mail transmission. When a program wants to send a message, it executes /usr/sbin/sendmail and gives it the entire message in stdin.

The Sendmail MTA was the first one to work this way (and still does), and other MTAs follow the same convention of providing a /usr/sbin/sendmail program.

[In this answer, Sendmail is the original MTA, and sendmail (lowercase) is /usr/sbin/sendmail (which comes with all MTAs currently used).]

PHP's mail() follows the Unix tradition and just passes the message to the sendmail executable. Which means you need a MTA. You already installed Postfix, which is good. However, it does have a sendmail binary, so if you don't have it in /usr/sbin/, then you must have installed it elsewhere -- perhaps /usr/local/sbin/ if compiled from source?

Reinstalling Postfix may fix the problem. If it doesn't, please update your question with details such as how did you install Postfix in the first place.

If your sendmail is somewhere else than /usr/sbin/, then you will have to edit PHP's configuration -- php.ini. It's usually in /etc/php5/, and Debian has three of those. (cgi/ is for generic CGI/FCGI, apache2/ is for the Apache PHP module, cli/ is for when PHP is used from command line.)

share|improve this answer
Thanks, reinstallation of postfix fixed the problem – Tristan Jun 4 '10 at 10:11

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.