Skip to content

Instantly share code, notes, and snippets.

@biswajitpaul01
Created March 16, 2019 13:25
Show Gist options
  • Save biswajitpaul01/980fbc5875fe6bd41b8e9691459c6a93 to your computer and use it in GitHub Desktop.
Save biswajitpaul01/980fbc5875fe6bd41b8e9691459c6a93 to your computer and use it in GitHub Desktop.
Send html mail without inline css
<?php
// To send HTML mail, the Content-type header must be set
$headers = [];
$headers[] = 'MIME-Version: 1.0';
$headers[] = 'Content-type: text/html; charset=iso-8859-1';
$headers[] = 'From: Do Not Reply <[email protected]>';
$content = '
<html>
<head>
<style>
p {
color: red;
font-size: 18px;
}
</style>
</head>
<body>
<p>This is test message.</p>
</body>
</html>
';
echo mail( '[email protected]', 'From Human', $content, implode("\r\n", $headers) ) . PHP_EOL;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment