I have installed php, mySQL, postfix and sendmail and have set up a simple email script on my local host server. mail() returns 1 (TRUE) when I send an e-mail, however the email does not arrive at the destination.


The mail functions are part of the PHP core. There is no installation needed to use these functions.


For the mail functions to be available, PHP requires an installed and working email system. The program to be used is defined by the configuration settings in the php.ini file.

Runtime Configuration The behavior of the mail functions is affected by settings in the php.ini file.

Mail configuration options:

Name            Default     Description                                         Changeable
sendmail_path   NULL        Unix systems only: Specifies where the sendmail
                            program can be found (usually /usr/sbin/sendmail
                            or /usr/lib/sendmail)                               PHP_INI_SYSTEM

I found it at /usr/lib/sendmail however, I can not find the configuration file, which is where I assume my problem is, as I have not told anything which server I am using to send my mail through.

If anyone can help me I would be grateful.


3 Answers 3


You should not have both Postfix and Sendmail installed at the same time. Postfix is a replacement for Sendmail.

So remove Sendmail (because Postfix is easier to use):

sudo apt-get remove sendmail

Then you should reconfigure Postfix.

 sudo dpkg-reconfigure postfix

There is a very good guide here: https://help.ubuntu.com/community/Postfix

This will probably solve your problem.

  • 1
    Thanks for that, I was tying myself in knots trying to sort it out :) Jul 1, 2013 at 8:36

To send email through Gmail from localhost please check PHP+Ubuntu Send email using gmail form localhost is possible another answer.


Another way of send mail Here... Send mail From Your account to Any email in PHP... Use (PHP-Mailer) function ,It's set of Php-codes(library) Form Online(hithup) to download to make easily configure to (google apps For mail send) set the setting enable on (Less-secure app-in google mail) thats like use your mail account to send the mail. If you any doubts view use youtube video for PHP-Mailer function. Thanks.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .