Last active
September 16, 2017 21:53
-
-
Save luckyshot/6bc4482aa151bd4d09af to your computer and use it in GitHub Desktop.
HTML emails in 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 | |
$email = array( | |
'fromName' => 'Adam', | |
'fromEmail' => '[email protected]', | |
'toName' => 'Bob', | |
'toEmail' => '[email protected]', | |
//'cc' => '[email protected]', | |
'subject' => 'Website Change Request', | |
'body' => 'Hello,<br>Bye', | |
'headers' => "From: ".$email['fromName']." <".strip_tags( $email['fromEmail'] ).">\r\n". | |
"Reply-To: ".$email['fromName']." <".strip_tags( $email['fromEmail'] ).">\r\n". | |
//"CC: ".$email['cc']."\r\n". | |
"MIME-Version: 1.0\r\n". | |
"Content-Type: text/html; charset=utf-8\r\n", | |
); | |
echo mail( $email['to'], $email['subject'], $email['body'], $email['headers']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment