Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML email just shows as Code [duplicate]

Tags:

html

php

email

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 I make it interprited as HTML rather then just text?!

For everyone asking to see the code

<?php
//The email of the sender
$email = $_POST['email'];
//The message of the sender
$message = "<html></html>";
//The subject of the email
$subject = "Fanshawe Student Success";
$extra = $email."\r\nReply-To: ".$email."\r\n";
mail($email,$subject,$message,$extra);
?>
like image 567
Philip Kirkbride Avatar asked Feb 05 '26 06:02

Philip Kirkbride


1 Answers

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

like image 163
Tim Hoolihan Avatar answered Feb 06 '26 20:02

Tim Hoolihan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!