2012-09-22 26 views
-1

這是我當前的代碼,但它繼續發送:(幫助時顯示HTML標籤PHP的郵件仍然viewring 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*******[email protected], [email protected]'; 
    $subject = "Request on $typesup"." from $personemail"; 

    $headers = 'From: [email protected]'; 

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

bleh,那真的搞垮了coe <_ <抱歉 - http://pastie.org/4782815 – user1478935

回答

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>

+0

問題在於頭被覆蓋,但HTML也是無效的。 – doublesharp

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*******[email protected], [email protected]'; 
$subject = "Request on $typesup"." from $personemail"; 

$headers = 'From: [email protected]'; // THIS LINE IS OVERWRITING IT! 

更改=到=

希望有所幫助。

+0

另外$ body不包含完整的HTML – doublesharp

+0

它應該仍然輸出文檔,但不顯示標籤,儘管我相信。我原本以爲這是問題,直到我看到失蹤。在= ;-)前面。 – David

+0

當然,你確定實際的問題是頭被覆蓋,我只是指出了無效的HTML。我有點強迫症:) – doublesharp