发送到gmail客户端的PHP邮件显示很奇怪

时间:2013-02-04 19:05:42

标签: php email gmail content-type email-headers

我正在使用 PEAR Mail 包发送电子邮件。

我正在通过PHP发送一封电子邮件,其中包含以下标题

Content-Type:text / html;字符集= utf-8的 Content-Transfer-Encoding:引用打印

在代码中:

$boundary = "--".md5(uniqid(time()));
$headers .= "MIME-Version: 1.0\n";
$headers .="Content-Type: multipart/related; boundary=\"$boundary\" text/html \n";
$headers .= 'From: ' . $frm . ' <' . $mail_id . '>' . "\r\n";
$multipart = '';
$multipart .= "--$boundary\n";
$kod = 'utf-8';
$multipart .= "Content-Type: text/html; charset=$kod\n";
$multipart .= "Content-Transfer-Encoding:Quot-Printed\n\n";//
$multipart .= "$html\n\n";

我可以使用除gmail之外的任何电子邮件客户端完全接收电子邮件。

Gmail会显示如下输出:

----4a243e2279b9b14ad664884c5587652e
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: Quot-Printed

<Div style="width:600px; margin:0 auto; padding:0; box-shadow:0px 0 5px #999; padding-bottom:20px; background:#FFF;">
<table width="600" border="0" cellspacing="0" cellpadding="0" style="margin:0 auto; padding:0; font-size:12px;" align="justify">
<tr>
<td align="center">
     <div style="padding: 20px; border-bottom: 5px solid #0F52A0;">
          <img src="cid:32b35a30e38aabdf5e45948c92b698ee" width="232" height="63" style="margin:0; padding:0; border:0; display:block;" border="0" /> </div></td>
</tr>
<tr>
<td>
    <table width="530" border="0" cellspacing="0" cellpadding="0" style="margin:0 auto; padding:0;">
    <tr>
        <td style="line-height:20px; font-size:12px;"><p style="margin:0; padding:0; line-height:18px">&nbsp;&nbsp;</p><p style="margin:0; padding:0; font-size:12px;"><strong style="font-size:14px;">Dear XXX</strong><br>

        </p>
        <p style="margin:0; padding:0; line-height:18px">&nbsp;&nbsp;</p>
        <p style="margin:0; padding:0; line-height:18px" >
        Thank you for your interest in our newsletter
        </p>
        <p style="margin:0; padding:0; line-height:18px" >
             You are not required to print this email.
        </p>
        <p style="margin:0; padding:0; line-height:18px">&nbsp;&nbsp;</p>
           <p style="margin:0; padding:0; line-height:18px">

已尝试过以下标题 内容类型:multipart / mixed; 内容类型:multipart / alternative; 内容传输编码:7位 内容 - 处置:内联 还尝试完全删除Content-Transfer-Encoding。

请建议!

0 个答案:

没有答案