【发布时间】:2011-10-15 04:55:18
【问题描述】:
使用 PHP 发送电子邮件。
我希望它是基于 HTML 的,但是当我在收件箱中收到电子邮件时,它只显示原始代码。
我怎样才能将其解释为 HTML 而不仅仅是文本?!
对于所有要求查看代码的人
<?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);
?>
【问题讨论】:
-
如何你显示一些代码,以便我们知道你在说什么。
-
也许您应该向我们展示您发送电子邮件的代码?
-
使用 Swiftmailer 或 PHPMailer 并停止构建您自己的 MIME 消息。
-
phpMailer 类是一个好的开始!