Skip to content

Instantly share code, notes, and snippets.

@nickrouty
Created May 6, 2013 16:35
Show Gist options
  • Save nickrouty/5526265 to your computer and use it in GitHub Desktop.
Save nickrouty/5526265 to your computer and use it in GitHub Desktop.
Send HTML Email in PHP
$to = 'mail@example.com';
$from = 'you@example.com';
$reply_to = 'you@example.com';
$subject = 'Website Change Reqest';
$headers = "From: " . strip_tags($from) . "\r\n";
$headers .= "Reply-To: ". strip_tags($reply_to) . "\r\n";
$headers .= "CC: " . strip_tags($from) . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$message = '<html><body>';
$message .= '<h1>Hello, World!</h1>';
$message .= '</body></html>';
mail($to, $subject, $message, $headers);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment