If your PHP mail function fails to work or if it displays an error message mail function error in Php, then you are in a situation to engage in troubleshooting. Check the spam folder first, because if your message is not reaching the recipient’s inbox, then it is essential to update the spam filter of the recipient. Another important thing is that you need to check your inbox for bounce-back messages. Send a php test mail using simple php mail tester commands and wait for the result. If you find that everything is okay, then the problem is with the SMTP server settings. Make sure that your firewall settings are disabled temporarily to prevent blockage issues.