-1

这是我当前的代码,但它在发送时继续显示 html 标签 :( 帮助?

<?php
    $personip = $_POST['name'];
    $personip = getenv("REMOTE_ADDR");
    $typesup = $_POST['typesupport'];
    $timesent = date("F j, Y, g:i a");
    $personemail = $_POST['email'];
    $message = $_POST['message'];
    $headers = "MIME-Version: 1.0\r\n";
    $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

    $body = "<html><body>"."Support Request - iSter"."<br>"."Sent from IP:"."$personip"." "."from:"."$personemail"."At time:"."$timesent"."<br>"."Message:"."<br>"."$message";


    $to      = 'jon*******5@gmail.com, anotheruser@example.com';
    $subject = "Request on $typesup"." from $personemail";

    $headers = 'From: support@mysite.im';

    mail($to, $subject, $body, $headers);
?>
4

2 回答 2

1

您在发送之前覆盖了您的标题:

$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

$body = "<html><body>"."Support Request - iSter"."<br>"."Sent from IP:"."$personip"." "."from:"."$personemail"."At time:"."$timesent"."<br>"."Message:"."<br>"."$message";


$to      = 'jon*******5@gmail.com, anotheruser@example.com';
$subject = "Request on $typesup"." from $personemail";

$headers = 'From: support@mysite.im'; // THIS LINE IS OVERWRITING IT! 

将 = 更改为 .=

希望有帮助。

于 2012-09-22T23:55:38.503 回答
0

您需要正确关闭 html 标签:

$body = "<html><body>"."Support Request - iSter"."<br>"."Sent from IP:"."$personip"." "."from:"."$personemail"."At time:"."$timesent"."<br>"."Message:"."<br>"."$message</body></html>";

</body></html>留言后忘记添加了。

于 2012-09-22T23:55:04.720 回答