0

Pair.net 最近升级了我们的 PHP 安装,之后客户端开始在电子邮件正文中看到 HTML,之前他看到的是格式化的电子邮件正文。

我将自己添加为抄送,我的 Outlook 向我显示了格式化的正文,但在同一封电子邮件中他看到了代码。

有人遇到过这个吗?

有什么提示吗?

代码如下:

$headers = "From: $name <$email>\r\n" . 
    "Reply-To: $email\r\n" .
    "X-Mailer: PHP/" . phpversion(). 
    'MIME-Version: 1.0' . "\r\n" .
    'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$msg = "<html><body><head><style type='text/css'>TD { font-family: Tahoma, Helvetica, sans-serif, Arial, Verdana; font-weight:bold; }</style></head>";
$msg .="<table width='98%' border='0' cellspacing='8'> etc etc etc

mail("$to, me@myoffice.com", $sub, $msg, $headers);

实际的电子邮件标题如下:

Delivered-To: xxx@xxx.com
Received: by 10.204.63.10 with SMTP id z10cs87437bkh;
        Wed, 8 Jun 2011 12:50:43 -0700 (PDT)
Received: by 10.216.230.105 with SMTP id i83mr5392587weq.43.1307562643519;
        Wed, 08 Jun 2011 12:50:43 -0700 (PDT)
Return-Path: <anonymous@tinco.pair.com>
Received: from tinco.pair.com (tinco.pair.com [209.68.1.91])
        by mx.google.com with SMTP id f69si2172888wes.55.2011.06.08.12.50.42;
        Wed, 08 Jun 2011 12:50:43 -0700 (PDT)
Received-SPF: pass (google.com: best guess record for domain of anonymous@tinco.pair.com designates 209.68.1.91 as permitted sender) client-ip=209.68.1.91;
Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of anonymous@tinco.pair.com designates 209.68.1.91 as permitted sender) smtp.mail=anonymous@tinco.pair.com
Received: (qmail 11613 invoked by uid 65534); 8 Jun 2011 19:50:41 -0000
Date: 8 Jun 2011 19:50:41 -0000
Message-ID: <20110608195041.11612.qmail@tinco.pair.com>
To: sales@yyy.com, xxx@xxx.com
Subject: WEBSITE BERG SELECTION FORM
From: David XXX <xxx@xxx.com>
Reply-To: xxx@xxx.com
X-Mailer: PHP/5.3.6MIME-Version: 1.0
Content-type: text/html; charset=iso-8859-1
4

2 回答 2

1

更新(原文如下)

您在标题中忘记了换行符;)在 X-Mailer 标题和 MIME-Version 标题之间应该有一个\r\n......它正在吞噬 MIME-Version(也在您的例如标题中):

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

旧的(潜在的)答案

我认为这可能是……情况,正确的标题是:

Content-Type: text/html;charset="iso-8859-1"

也可能存在传输编码问题(Content-Transfer-Encoding标头)

于 2011-06-08T20:16:12.513 回答
0

我继续认为服务器升级和切换到 qmail 可能已经做到了这一点,但问题通过切换到SwiftMail得到解决。

于 2011-06-13T19:43:53.547 回答