2012-02-05 191 views
2

当我发送一个html邮件时,我可以在我的iPad和Gmail中阅读它。但Outlook和我的iMac程序邮件不显示正文消息。他们显示一个空白的消息。我在下面放置了原始信息。我希望有人能告诉我它有什么问题。HTML邮件显示空白邮件

Delivered-To: ****@gmail.com 
Received: by 10.50.196.*** with SMTP id io4cs329714igc; 
     Sun, 5 Feb 2012 05:32:52 -0800 (PST) 
Received: by 10.14.206.*** with SMTP id l5mr4398177eeo.22.1328448771870; 
     Sun, 05 Feb 2012 05:32:51 -0800 (PST) 
Return-Path: <***@***.nl> 
Received: from ***.****.nl ([85.17.***.***]) 
     by mx.google.com with ESMTPS id n46si6997510eeh.10.2012.02.05.05.32.51 
     (version=TLSv1/SSLv3 cipher=OTHER); 
     Sun, 05 Feb 2012 05:32:51 -0800 (PST) 
Received-SPF: neutral (google.com: 85.17.145.53 is neither permitted nor denied by best guess record for domain of ***@***.nl) client-ip=85.17.145.***; 
Authentication-Results: mx.google.com; spf=neutral (google.com: 85.17.145.*** is neither permitted nor denied by best guess record for domain of ***@***.nl) smtp.mail=***@***.nl 
Received: from **** by ***.nl with local (Exim 4.72) 
    (envelope-from <***@***.nl>) 
    id 1Ru2CW-0000Fj-Dp; Sun, 05 Feb 2012 14:32:16 +0100 
Date: Sun, 05 Feb 2012 14:32:16 +0100 
Message-Id: <[email protected]***.***.nl> 
To: ***@gmail.com 
Subject: Test html mail 
From: *****.nl<*****@*****.nl> 
To: ***@gmail.com 
MIME-Version: 1.0 
Content-Type: multipart/alternative; boundary="9f540ec8b1c1552cbe71240502b3f9e8" 
Sender: <***@***.nl> 

--9f540ec8b1c1552cbe71240502b3f9e8 
Content-Type: text/plain; charset=iso-8589-1 
Content-Transfer-Encoding: 8bit 
If you are seeing this is because you may need to change your 
preferred message format from HTML to plain text. 

Activeer uw HTML mail instellingen. 
--9f540ec8b1c1552cbe71240502b3f9e8 
Content-Type: text/html; charset=iso-8589-1 
Content-Transfer-Encoding: 8bit 
<html> 
<head> 
<title>Hello world</title> 
</head> 
<body> 
this is a test. 
</body> 
</html> 

我希望你能理解我的问题。对不起,我的英语不好。

回答

0

要发送的邮件我这样做:

$message = '<html><body><p align="center">XXXXXXXX</p></br></br></body></html>'; 
    $to = "[email protected]"; 
    $headers = "From: mail <[email protected]>\r\n"; 
    $headers .= "MIME-Version: 1.0" ."\n"; 
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; 
    $object = ""; 
    $result = mail($to, $object, $message, $headers); 
+0

谢谢,但我想知道我的脚本中有什么问题。 – Tim 2012-02-05 14:33:33

+0

你能告诉我吗? – JackTurky 2012-02-05 14:36:48

1

应该有空白行的Content-Transfer-Encoding线和HTML部分之后,应当密切边界后:

--9f540ec8b1c1552cbe71240502b3f9e8 
Content-Type: text/plain; charset=iso-8589-1 
Content-Transfer-Encoding: 8bit 

If you are seeing this is because you may need to change your 
preferred message format from HTML to plain text. 

Activeer uw HTML mail instellingen. 
--9f540ec8b1c1552cbe71240502b3f9e8 
Content-Type: text/html; charset=iso-8589-1 
Content-Transfer-Encoding: 8bit 

<html> 
<head> 
<title>Hello world</title> 
</head> 
<body> 
this is a test. 
</body> 
</html> 
--9f540ec8b1c1552cbe71240502b3f9e8-- 
+0

谢谢,我要测试这个! – Tim 2012-02-05 15:49:22

+0

hm,不幸的是没有效果。 – Tim 2012-02-05 17:39:36

+0

这些更改是必需的,因此消息源可能存在另一个问题。你可以编辑你的问题,在你做出这些改变后显示源代码? – SimonMayer 2012-02-05 18:17:40