Sample PHP script to test the mail function

You may use the below script to test whether the mail function via PHP script is working well in the server.

<?php
$to = "[email protected]";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "[email protected]";
$headers = "From: $from";
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>
Scroll to Top