在outlook.com和Windows谈到通过罚款8邮件程序。 但是,当发送到我的客户端的桌面Outlook程序涉及通过这样的:

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

From: [email protected]*** 
X-Brightmail-Tracker: AAAAAQAAAlk= 

<b>REF</b>: 513a8440922ea<br /><b>On</b>: 09/03/2013 00:40:59<br /><b>First 
name</b>: a name<br /><b>Last name</b>: a last name<br /><b>Company name</b>: My 
Company name<br /><b>Address</b>:<br /> an address,<br /> 

2,<br /> 

3,<br /> 

4,<br /> 

postcode<br /><b>Telephone number</b>: 521213091<br /><b>Email</b>: 
****.co.uk<br /><b>Website</b>: site.com<br 
/><b>Skills</b>:<br /> I do not have any skills to assist with.<br /> 

<br /> 

Sorry<br /><b>Payment method</b>: Bank transfer<br /> 

有什么不对我的代码?

我只是尝试添加此:

Content-Type: text/plain; charset=us-ascii 
Content-Transfer-Encoding: 7bit 

现在我收到outlook.com的电子邮件是唯一的HTML。这样就杀了它?啊,这里有什么问题!

+0

可能重复(http://*.com/questions/3058897/sending-html-email-from-php) – j0k 2013-03-09 11:33:01

看来你缺少MIME规格:补充一点:

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

它也显示在PHP-Documentation for the mail-function

+0

原来的职位状态的MIME-版本?它已经在那里了? – Jimmyt1988 2013-03-09 11:38:27

+0

@JamesT你的输出不包含MIME标记 – Vineet1982 2013-03-09 11:41:47

+0

因此,而不是将它添加到$头部分,我应该将它添加到$ body?它已经宣布为标题,你可以看到上面 – Jimmyt1988 2013-03-09 11:43:14

我不确定,但这可能是因为您错过了开头<html>并关闭</html>标签。

邮件()函数的example in the documentation可能会有所帮助。

+0

Right,ill试试看:D谢谢 – Jimmyt1988 2013-03-09 11:51:11

+0

@JamesT:有用吗? – 2013-03-09 18:08:52

+0

不,它没有......我想我添加了一个标题,但它似乎在那之后工作?但我只是不相信..所以不知道答案是什么,但它不是HTML。 – Jimmyt1988 2013-03-12 01:50:00

这是我正在使用的代码片段。我工作得很好。 [从PHP发送HTML邮件]的

// Boundary 
$innerboundary ="=_".time()."_="; 

// Mail-Header 
$header ="MIME-Version: 1.0\n"; 
$header.="From: [email protected]\n"; 
$header.="Reply-To: [email protected]\n"; 
$header.="X-Mailer: kmPHP-Mailer\n"; 
$header.="Content-Type: multipart/alternative;\n\tboundary=\"".$innerboundary."\"\n"; 

// Mail-subject 
$subject ="Subject goes here"; 
$body =""; 

// HTML part 
$body.="\n--".$innerboundary."\n"; 
$body.="Content-Type: text/html;\n\tcharset=\"iso-8859-1\"\n"; 
$body.="Content-Transfer-Encoding: base64\n\n"; 
$body.=chunk_split(base64_encode(($html_string_goes_here)))."\n\n"; 
$body.="\n--".$innerboundary."--\n"; 
$body.="\n\n"; 
+0

感谢您的帮助,但这似乎在电子邮件中输出无稽之谈 – Jimmyt1988 2013-03-09 17:24:02

相关推荐