PHP script to send mails

You may use the below script to test whether 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.";
?>