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.

I can send an email through the terminal command ssmtp just fine but I cant send an email through PHP with the mail() function. I have configured it to do so correctly (afaik) through php.ini.

sendmail_path = "/usr/sbin/ssmtp -t -i"

Is my sendmail path. Still not working though. I know the ssmtp command itself works just fine, just not through PHP. It doesnt give any errors or anything.

mail("email@gmail.com", "Test", "Testing blah");

Is the code im using in PHP. Im using PHP5 and Apache 2. I have tried restarting the Apache 2 server.

Any ideas? Im using the right config file as I got PHP to echo out the directory to the config file. Thanks!

share|improve this question

2 Answers 2

According to the manpage there is no -i option to ssmtp.

This blog suggests that the correct setting is:

sendmail_path = /usr/sbin/ssmtp -t
share|improve this answer
    
Changed it to that and still nothing... Any ideas? –  James Heald Jun 12 '13 at 12:25

First off; check /var/log/mail.log and /var/log/mail.err

I had the same problem, and I think what solved it was adding this line to /etc/ssmtp/revaliases:

www-data:username@host.com:smtp@host:PORT

share|improve this answer

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.