我的麻烦是PHPMailer发送电子邮件,但在邮件中只包含P标签。 我的错误在哪里?
include 'class.phpmailer.php';
$Mailer = new PHPMailer();
$Mailer->CharSet = 'UTF-8';
$Mailer->Body = '<html style="background: #FF0000;"><body><p>dsdgs</p></body></html>';
$Mailer->SetFrom('mailer@stpoisk.ru', 'Иванов Владимир');
$Mailer->AddAddress('mysss2019@gmail.com');
$Mailer->Subject = 'Тема';
$Mailer->IsHTML(true);
$Mailer->Send();
在我的Gmail帐户中,我收到了我发送的html代码,但它没有正确呈现,只有纯文本;
Delivered-To: mysss2019@gmail.com
Received: by 10.50.237.35 with SMTP id uz3csp342713igc;
Wed, 16 Apr 2014 13:03:33 -0700 (PDT)
X-Received: by 10.112.13.72 with SMTP id f8mr2901958lbc.40.1397678612593;
Wed, 16 Apr 2014 13:03:32 -0700 (PDT)
Return-Path: <motostz6@appolon0.beget.ru>
Received: from appolon0.beget.ru (appolon0.beget.ru. [91.106.203.74])
by mx.google.com with ESMTPS id lb6si15770273lab.212.2014.04.16.13.03.32
for <mysss2019@gmail.com>
(version=TLSv1 cipher=RC4-SHA bits=128/128);
Wed, 16 Apr 2014 13:03:32 -0700 (PDT)
Received-SPF: pass (google.com: domain of motostz6@appolon0.beget.ru designates 91.106.203.74 as permitted sender) client-ip=91.106.203.74;
Authentication-Results: mx.google.com;
spf=pass (google.com: domain of motostz6@appolon0.beget.ru designates 91.106.203.74 as permitted sender) smtp.mail=motostz6@appolon0.beget.ru
Received: from motostz6 (Authenticated sender motostz6@appolon0.beget.ru)
by appolon0.beget.ru with local (Exim 4.76)
(envelope-from <motostz6@appolon0.beget.ru>)
id 1WaW3P-0005KN-AD
for mysss2019@gmail.com; Thu, 17 Apr 2014 00:03:31 +0400
To: mysss2019@gmail.com
Subject: =?UTF-8?B?0KLQtdC80LA=?=
Date: Thu, 17 Apr 2014 00:03:31 +0400
Message-ID: <5f69d9a84b6e6aa939460da74bee0bd9@www.novator18.ru>
X-Priority: 3
X-Mailer: PHPMailer 5.1 (phpmailer.sourceforge.net)
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/html; charset="UTF-8"
From: motostz6@appolon0.beget.ru
Reply-To: Рванов Владимир <mailer@stpoisk.ru>
X-Beget-Rewrite: original from 'Рванов Владимир <mailer@stpoisk.ru> '
X-Beget-Rewrite: original reply-to 'Рванов Владимир <mailer@stpoisk.ru> '
<html style="background: #FF0000;"><body><p>dsdgs</p></body></html>
答案 0 :(得分:0)
您使用的是古老版本的PHPMailer。来自GitHub的Try something recent。也就是说,该消息格式正常(它在Apple Mail中呈现正常),但是gmail对CSS做了很多讨厌的事情,并且在html标记中放置样式属性有点奇怪,所以你可能会更成功地设置背景颜色body标签上的一个属性:
<html><body bgcolor="#FF0000"><p>dsdgs</p></body></html>