PHP email script to test email

Sometimes you gotta test outgoing email. If you have php installed, it is as easy as adding the following into a file called something like emailtest.php and executing with php emailtest.php. Check the email logs to ensure it went out.

< ?php
$to = "someone@somewhere.com";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "someonelse@somewhere-else.com";
$headers = "From:" . $from;
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>

About vicki

Welcome to the Sovereign Republic of Vickistan. I am the President here. Lucky me! No taxes or laws yet. Lucky you!
This entry was posted in Linux. Bookmark the permalink.

Leave a Reply

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