Simple test on send mail from server using PHP

This is a simple test script to check if the server can send mail using PHP, just change the receiver address.

<?php
 $to
= "my.name(at)gmail.com";
 
$subject = "Test";
 
$body = "Hi,\n\nThis is a test.";
 if (
mail($to, $subject, $body)) {
   echo(
"<p>Message sent!</p>");
  } else {
   echo(
"<p>Message failed!</p>");
  }
 
?>
Knowledge keywords: