PHP check if mail() function is enabled on your server

To check if mail function is enabled on your apache server you can try one of the following:

Check your php.ini like this:

You should search for this in the list sendmail_path that has the default  value /usr/sbin/sendmail -t -i

You can also try to manual set it to this value by changing the php.ini file. To do this go to  /etc/php5/apache2/php.ini and uncomment the sendmail_path line like this

If it did not work for you, try to find out if the function exists in the first place.

And finally you can test what the php mail() function returns.

But more important than this is if the email arrives to your inbox (or Spam folder).

I have also find myself in need to check the mail function a WordPress platform. You can do this on WordPress by installing Check Email plugin. Although it has not been updated lately it still works and it does the job that it was installed for.

check mail

Like I said, a positive result does not mean that the email will be received. There are much more things to check here.

Hope this helped you. If not please let me know how you finally solve it.

 

Leave a Reply

Your email address will not be published. Required fields are marked *