格式化电子邮件在PHP?

时间:2010-12-31 15:38:09

标签: php html email

$to = "$email";
$subject = "Thank You";
$message = "<p>Thanks for applying</p>";
$from = "solomon@kornar.com";
$headers = "From: $from";
mail($to,$subject,$message,$headers);

当我发送这封电子邮件给自己时,我仍然看到html标签,为什么这是谢谢!!

2 个答案:

答案 0 :(得分:4)

您需要将Content-type标题发送为text/html

例如,将$headers行更改为

$headers = "From: $from";
$headers .= "\nContent-type: text/html";

答案 1 :(得分:1)

您需要设置标头内容类型。像:

$headers.= 'Content-type: text/html; charset=UTF-8' . "\r\n";