Created
October 28, 2015 16:54
-
-
Save johnmorris/3310cbb18ea6d104974a to your computer and use it in GitHub Desktop.
How to send email with PHP
This file contains hidden or 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 | |
// Recipient | |
$to = 'RECIPIENT EMAIL ADDRESS'; | |
// Subject | |
$subject = 'This is our test email'; | |
// Message | |
$message = '<h1>Hi there.</h1><p>Thanks for testing!</p>'; | |
// Headers | |
$headers = "From: The Sender Name <SENDER EMAIL ADDRESS>\r\n"; | |
$headers .= "Reply-To: REPLY-TO EMAIL ADDRESS\r\n"; | |
$headers .= "Content-type: text/html\r\n"; | |
// Send email | |
mail($to, $subject, $message, $headers); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment