Created
March 16, 2019 13:25
-
-
Save biswajitpaul01/980fbc5875fe6bd41b8e9691459c6a93 to your computer and use it in GitHub Desktop.
Send html mail without inline css
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 | |
// 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