<?php ini_set( 'display_errors', 1 ); error_reporting( E_ALL ); $from = "emailtest@YOURDOMAIN"; $to = "YOUREMAILADDRESS"; $subject = "PHP Mail Test script"; $message = "This is a test to check the PHP Mail functionality"; $headers = "From:" . $from; mail($to,$subject,$message, $headers); echo "Test email sent"; ?>
A useful mini script to test the PHP mail() function.
Particularly useful to help test account setup and ensure emails can be sent from PHP webites. If you have made changes (e.g. enabled SMTP in the PHP settings) or moved hosts, this is a quick way to test that the PHP mail () function is working.
For WordPress websites where you want to improve delivery. This plugin is recommended: Stop wp emails going to spam