Last active
July 14, 2018 10:26
-
-
Save Grendel7/bdf75a5acd4afc98064abd5b29a96ef5 to your computer and use it in GitHub Desktop.
Simple script to test PHP mail is working
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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