Why is my PHP mail function not working?

Linode Staff

I'm calling PHP's mail(), but it's not working. What should I do?

1 Reply

To troubleshoot this, a good first step would be to enable error logging for PHP. To do this, you can put these function calls before the call to the mail() function that you're making:

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

Then, review the logs that are produced for more clues. Your PHP might also have a separate mail log set up (like /var/log/phpmail.log). This can be specified in your php.ini file under the mail.log option. You can find where your php.ini file with these steps:

How can I find my php.ini file?

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct