PHP mail not working but sendmail does

  • Posted on September 22, 2014
  • romeldrisAsked by romeldris

Hey guys,

I’m able to send mails through sendmail but I’m unable to send mail with the PHP mail() function. I changed it in the config files as well but it’s not being sent. When I type sendmail in the terminal, I’m able to send it. Am I supposed to configure something else to get PHP mail to work?

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

This question was answered by @kamaln7:

Are you getting any errors? Try adding the following line at the top of your php script:

ini_set('display_errors', 1); error_reporting(-1);

That should make php output all errors to the web browser.

You can see the comment here.