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

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 notifications@fostergen.com 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

root=notifications@fostergen.com
mailhub=smtp.fostergen.com:587 (Here I have doubt. I am not sure what to use here. I tried smtp.fostergen.com:587, smtp.fostergen.com:25,mx1.mailhostbox.com :587,mx1.mailhostbox.com:25.

I am still not sure what to use here mailhostbox.com. I used mx1.mailhostbox.com as it was the mx entry for my domain on bigrock Here is the screenshot![screenshot of bigrock's email management tool] )

hostname=vs3204.ams2.alvotec.de (I entered the command hostname -f on my server and got it as result )

FromLineOverride=YES    
UseSTARTTLS=YES    
AuthUser=notifications@fostergen.com    
AuthPass=password provided during email registration on bigrock

> edited /etc/ssmtp/revaliases 
(added " root:notifications@fostergen.com:mx1.mailhostbox.com :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
    hostname=smtp.fostergen.com:587
   username= notifications@fostergen.com
   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
1  
Contact your hosting support, tell them the PHP mail function does not work for you. –  hakre Sep 28 '12 at 11:56
add comment

migrated from stackoverflow.com 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.

1 Answer

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 127.0.0.1 as you don't want to receive/relay mail (inet_interfaces = 127.0.0.1 in /etc/postfix/main.cf). 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
add comment

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