What it does: Sends a simple email using mail()
to confirm outbound mail is configured. Set the recipient and align SPF/DKIM/SMTP as needed.
Note: Production apps often use SMTP with authentication rather than mail()
.
<?php
$to = "email@example.com"; // change me
$ok = mail($to,"Test","Hello from PHP","From: noreply@".$_SERVER['HTTP_HOST']);
echo $ok ? "Sent" : "Failed";
?>
For safety, this page links out to the live script rather than auto-running it.