How to get php mail function to work on Debian “squeeze”?
        Posted  
        
            by 
                Neel Kamal
            
        on Server Fault
        
        See other posts from Server Fault
        
            or by Neel Kamal
        
        
        
        Published on 2012-09-28T11:41:10Z
        Indexed on 
            2012/09/29
            15:41 UTC
        
        
        Read the original article
        Hit count: 452
        
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 [email protected] 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
[email protected]
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    
[email protected]    
AuthPass=password provided during email registration on bigrock
> edited /etc/ssmtp/revaliases 
(added " root:[email protected]: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= [email protected]
   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?
© Server Fault or respective owner