Ran into an issue recently, needed to install sendmail on a server and even with PHP configured correct, absolutely no emails were going through.
A quick tip, check
/var/log/syslog, it usually contains information on the error.
The error in this case was that the hostname was not configured to a FQDN e.g. the contents of
Here is a script to test email is working:
<?php ini_set( 'display_errors', 1 ); error_reporting( E_ALL ); $to = "firstname.lastname@example.org"; mail($to, 'PHP Test E-mail', 'This is a test e-mail ' . date('r'), ['From: server@'.php_uname('n')]); echo "Test email sent";
It can be run from the commandline using
php test.php or in the browser by accessing the URL.