php mail 发送html,PHP使用mail()发送html – 某些服务器以文本形式接收

我搜索了很多,但找不到任何解决方案.

在我的代码更改几个小时后,我尝试从php.net的例子,它的行为相同.

如果我把它发送到我的Gmail地址一切都很好,

如果我将它发送到另一台服务器,它不会将其呈现为HTML.

我尝试了大约8台服务器,其中4台遇到了这个问题

这是代码(php示例):

// subject

$subject = 'Birthday Reminders for August';

// message

$message = '

Birthday Reminders for August

Here are the birthdays upcoming in August!

PersonDayMonthYear
Joe3rdAugust1970
Sally17thAugust1973

';

// To send HTML mail, the Content-type header must be set

$headers = 'MIME-Version: 1.0' . "\r\n";

$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// Additional headers

$headers .= 'To: Mary , Kelly ' . "\r\n";

$headers .= 'From: Birthday Reminder ' . "\r\n";

$headers .= 'Cc: birthdayarchive@example.com' . "\r\n";

$headers .= 'Bcc: birthdaycheck@example.com' . "\r\n";

// Mail it

mail($to, $subject, $message, $headers);

?>

这是来自gmail的“show original”(gmail只是客户端,邮件来自php服务器),消息没有正确显示 – html是raw:

Delivered-To: XXX

Received: by 10.220.35.74 with SMTP id o10csp285028vcd;

Sun, 9 Dec 2012 03:18:35 -0800 (PST)

Received: by 10.220.238.139 with SMTP id ks11mr6865773vcb.49.1355051914996;

Sun, 09 Dec 2012 03:18:34 -0800 (PST)

Received-SPF: softfail (google.com: best guess record for domain of transitioning unknown does not designate 82.80.232.249 as permitted sender) client-ip=82.80.232.249;

Received: by 10.230.67.134 with POP3 id r6mf4415353vbi.4;

Sun, 09 Dec 2012 03:18:34 -0800 (PST)

X-Gmail-Fetch-Info: gideon@example.com 5 mail.example.com 110 gideon@example.com

Received: from [82.80.232.249] by mail.example.com (ArGoSoft Mail Server .NET v.1.0.8.4) with ESMTP (EHLO web9.wishosting.net)

for ; Sun, 09 Dec 2012 13:18:02 +0200

Received: by web9.wishosting.net (Postfix, from userid 1168)

id C82D03EE2EC; Sun, 9 Dec 2012 13:18:23 +0200 (IST)

To: gideon@example.com, wez@example.com

Subject: Birthday Reminders for August

X-PHP-Script: example.com/lp/mailtest.php for 89.139.28.204

MIME-Version: 1.0

Date: Sun, 09 Dec 2012 13:18:02 +0200

Message-ID:

SPF-Received: none

X-FromIP: 82.80.232.249

From: gideon@example.com

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

To: Mary , Kelly

From: Birthday Reminder

Cc: birthdayarchive@example.com

Message-Id: <20121209111823.C82D03EE2EC@web9.wishosting.net>

Date: Sun, 9 Dec 2012 13:18:23 +0200 (IST)

Birthday Reminders for August

Here are the birthdays upcoming in August!

PersonDayMonthYear
Joe3rdAugust1970
Sally17thAugust1973
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值