PHP mail() function simple test script

This is a simple script you can use to test the functionality of the php mail() function on your server:

?php
$to = “your@emailaddress.here“; // <– replace with your address here
$subject = “Test mail”;
$message = “Hello! This is a simple test email message.”;
$from = “sender@emailaddress.here“;
$headers = “From:” . $from;
mail($to,$subject,$message,$headers);
echo “Mail Sent.”;
?>

Simply add your e-mail address, copy and paste the script into a .php file (eg. test.php), upload it on your server and access it directly. Once accessed, the file will return the message “Mail sent” and you should receive the test message in a couple of minutes tops (usually almost instantly).

Leave a comment

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

Time limit is exhausted. Please reload the CAPTCHA.