HomeScriptsSample PHP script to test the mail function

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 = "name@domain.com";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "test@test.com";
$headers = "From: $from";
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>
Scroll to Top