Html Email Just Shows As Code
Possible Duplicate: Sending HTML email from PHP Using PHP to send an email. I want it to be HTML based but when I get the email in my inbox it just shows the raw code. How can
Solution 1:
from the docs: http://php.net/manual/en/function.mail.php
$headers.= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
obviously $headers has to be passed to the mail
Solution 2:
here you go:
// multiple recipients$to= 'someemail@address.com';
//subject$subject= 'EmailTemplateforLazyPeople';
//message body$message="
<html>
<head>
<title>My Title</title>
</head>
<body>
<div>
<b>My email body</b>
</div>
</body>
</html>
";
//add headers$headers= 'MIME-Version: 1.0' . "\r\n";
$headers.= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers.= 'To: yourself<info@yourself.com>' . "\r\n";
$headers.= 'From: myself<info@myself.com>' . "\r\n";
//send mail
mail($to, $subject, $message, $headers);
Post a Comment for "Html Email Just Shows As Code"