PHP电子邮件被视为HTMl

时间:2011-10-24 05:44:08

标签: php

我有一个发送邮件功能,我希望将该邮件读取为HTML。

这是我的代码:

    $subject = "Request for Quotation: " . $name . " <" . $email . ">";

    $to = "echo@mysiteup.com";
    $message = 'Request for Quotation<br />';

    foreach ($post as $key => $value)
    {   
        $message .= ucfirst($key) . ': ' . $value . '<br />';   
    }

    $headers  = "MIME-Version: 1.0\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\n";

    $num = md5(time());

    $headers = "From: " . $name. " <" . $email . ">\r\n";
    $headers .= "MIME-Version: 1.0\r\n";
    $headers .= "Content-Type: multipart/mixed;";
    $headers .= "boundary=".$num."\r\n";
    $headers .= "--$num\r\n";

    $headers .= "Message-ID: <".gettimeofday()." TheSystem@".$_SERVER['SERVER_NAME'].">\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";
    $headers .= "".$message."\n";
    $headers .= "--".$num."\n"; 

    $mailSent = @mail($to, $subject, $message, $headers); 
    $return['msg'] = $mailSent ? 'Request for quotation sent.' : 'Request failed. Please try again later.';

我检查了电子邮件,并显示了标签。我该怎么做才能将电子邮件视为HTML?

0 个答案:

没有答案