Skip to content

Instantly share code, notes, and snippets.

@cam-gists
Created August 20, 2012 16:05
Show Gist options
  • Select an option

  • Save cam-gists/3405391 to your computer and use it in GitHub Desktop.

Select an option

Save cam-gists/3405391 to your computer and use it in GitHub Desktop.
PHP: HTML email
<?php
$to = 'name@mail.com';
$subject = $name . ' is requesting a free delivery';
$body = '<html>
<head>
<title></title>
</head>
<body>
<h1>Title</h1>
<table>
<tr>
<td></td>
</tr>
</table>
</body>
</html>';
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
$headers .= 'From: Server <server@server.com>';
mail($to, $subject, $body, $headers);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment