Skip to content

Instantly share code, notes, and snippets.

@Grendel7
Last active July 14, 2018 10:26
Show Gist options
  • Save Grendel7/bdf75a5acd4afc98064abd5b29a96ef5 to your computer and use it in GitHub Desktop.
Save Grendel7/bdf75a5acd4afc98064abd5b29a96ef5 to your computer and use it in GitHub Desktop.
Simple script to test PHP mail is working
<?php
$sender = 'from@example.com';
$recipient = 'to@example.com';
$subject = "PHP Mail Test Message";
$message = "PHP Mail Test Message";
$headers = [
'From: ' . $sender,
'Sender: ' . $sender,
];
if (mail($recipient, $subject, $message, implode("\n", $headers))) {
echo "Message sent!";
} else {
echo "Error: ".error_get_last()['message'];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment