Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

1 Answer 1

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

 
discard

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.