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

Possible Duplicate:
Getting PHP mail() function to work on Debian Lenny

I have installed Apache and PHP5 on my debian server.

Firstly I tried it using sendmail. Here is the step by step procedure that I have tried :

Step 1: apt-get install sendmail
Step 2: /etc/init.d/apache2 restart

But this didn't work.

Then I tried using external SMTP . My domain is registered on BigRock.I registerd an email address there and it gave me the required credentials.

On server I installed sSMTP

> apt-get install ssmtp
> Configured "/etc/ssmtp/ssmtp.conf" file.

In the configuration file I added (Here I have doubt. I am not sure what to use here. I tried,, :587,

I am still not sure what to use here I used as it was the mx entry for my domain on bigrock Here is the screenshot![screenshot of bigrock's email management tool] ) (I entered the command hostname -f on my server and got it as result )

AuthPass=password provided during email registration on bigrock

> edited /etc/ssmtp/revaliases 
(added " :587 " in the last line)
> edited php.ini file (sendmail_path = /usr/sbin/ssmtp -t)
> /etc/init.d/apache2 restart

But this didn't work.

After this I tried eSMTP. Steps Performed :

> apt-get install esmtp
> edited /etc/esmtprc
   password: password provide by bigrock
    mda="/usr/bin/procmail -d %T"
> linked eSMTP to the legacy Sendmail path by execting the command "ln -s /usr/bin/esmtp /usr/bin/sendmail" 
> edited php.ini file (/usr/bin/sendmail -t -i)
> /etc/init.d/apache2 restart

But this technique also failed.

I just want to send email to users through php mail function. Kindly help. Where I am going wrong?

share|improve this question

migrated from Sep 29 '12 at 13:04

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

marked as duplicate by mailq, rnxrx, Ward, Michael Hampton, Scott Pack Oct 5 '12 at 0:28

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Contact your hosting support, tell them the PHP mail function does not work for you. – hakre Sep 28 '12 at 11:56

It look like your question is :"How do I install an mta on my dedicated server and use it with php5"?

Therefore, there are 2 step to follow :

  • First one is to install an MTA. If you don't know much about mail servers, I suggest you postfix instead of sendmail: It is easier. For security reasons, make sure it listens only on as you don't want to receive/relay mail (inet_interfaces = in /etc/postfix/ Test that it works by sending an email from the command line interface. If it does not, look at logs (/var/log/mail.*).

  • Second step is to configure php to use postfix. If I record correctly, default debian values work out of the box, so no change needed.

share|improve this answer
Thanks..I have solved this problem by using google's SMTP server instead of installing my own mail server :) – Neel Kamal Oct 13 '12 at 4:19

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