The mail function takes three required parameters and optionally a fourth and fifth one. Make sure the mail() function is called correctlyīool mail ( string $to, string $subject, string $message ] ) Make sure it is there and not commented out.
It may seem silly but a common error is to forget to actually place the mail() function in your code. See How can I get useful error messages in PHP? - this answer for more details on this. Placing the following code at the top of your PHP files (or in a master configuration file) will enable error reporting. Error reporting needs to be enabled to receive these errors. Make sure error reporting is enabled and set to report all errorsĮrror reporting is essential to rooting out bugs in your code and general errors that PHP encounters. Without one you need to run through the checklist below to find any potential pitfalls you may be encountering. It's difficult to diagnose these things unless there is an obvious syntax error. There are a variety of reasons your script appears to not be sending emails. Although there are portions of this answer that apply to only to the usage of the mail() function itself, many of these troubleshooting steps can be applied to any PHP mailing system.