2013-02-28 69 views
-2

它不會添加以下標題信息,而是顯示PHP郵件中的HTML標記。顯示Html標記的PHP郵件

$headers = "From: ".$name."<".$email.">\r\n"; 
    $headers .= "Reply To: ".$email."\r\n"; 
    $headers .= "MIME-Version: 1.0\r\n"; 
    $headers .= "X-Mailer: PHP v".phpversion()."\r\n";   
    $headers .= "Content-Type: text/html; charset=iso-8859-1\r\n"; 
    $headers .= "Content-Transfer-Encoding: 8bit\r\n"; 

請幫幫我。從我的郵件()

+0

輸出請!! – 2013-02-28 05:43:50

回答

0

$header = "From: Backapp.ru <[email protected]>\r\nContent-type: text/html; charset=utf-8"; 
1

試試這個,

$subject = 'Mail Subject'; 
    $message = 'Test'; 
    $headers = 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/html; charset=UTF-8' . "\r\n"; 
    $headers .= "X-Mailer: PHP \r\n"; 
    $headers .= 'From: ".$name."<".$email.">' . "\r\n"; 
    $headers .= 'Reply-To: ".$email."' . "\r\n"; 
    mail($to, $subject, $message, $headers); 
0

mail()功能與headers基本用法是:

<?php 
    $to = "[email protected]"; 
    $subject = "My email test."; 
    $message = "Hello"; 

    $headers = "From: [email protected]\r\n"; 
    $headers .= "Reply-To: [email protected]\r\n"; 
    $headers .= "Return-Path: [email protected]\r\n"; 
    $headers .= "CC: [email protected]\r\n"; 
    $headers .= "BCC: [email protected]\r\n"; 

    if (mail($to,$subject,$message,$headers)) { 
     echo "The email has been sent!"; 
     } else { 
     echo "The email has failed!"; 
     } 
    ?> 

你不要給我們你的輸出,所以我們不知道這個問題。