Sample PHP script to send emails

Sometimes you need to check if your server is able to send emails through PHP. Here is a sample PHP script to send emails:

<?php

$to = "someone@example.com,someother@example.com";

$subject = "Test mail";

$message = "Hello! This is a test email message.";

$from = "someonelse@example.com";

$headers = "From:" . $from;

mail($to,$subject,$message,$headers);

echo "Mail Sent.";

?>


Thank you.

Comments

Popular posts from this blog

SVN: File remains in conflict

HowTo: Enable extended logging for exim

12 tweakings for WHM/cPanel to speed up WordPress