Skip to content

Instantly share code, notes, and snippets.

@Cdetviler
Created April 4, 2017 12:41
Show Gist options
  • Save Cdetviler/6158f1de6b7f829475fa31dbc8da71f6 to your computer and use it in GitHub Desktop.
Save Cdetviler/6158f1de6b7f829475fa31dbc8da71f6 to your computer and use it in GitHub Desktop.
A quick php script to send an html email
<?php
$filepath = 'directory/test.html';
$html = file_get_contents ($filepath, FILE_USE_INCLUDE_PATH);
$subject = 'test-mail';
$recipient = '';
// To send HTML mail, the Content-type header must be set
$headers[] = 'MIME-Version: 1.0';
$headers[] = 'Content-type: text/html; charset=iso-8859-1';
mail($recipient, $subject, $html, implode("\r\n", $headers));
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment