Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

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("", "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

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:

share|improve this answer

Your Answer


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.