PHP 邮件 - MIME 组合
我编写了一些代码来生成并发送带有附件的电子邮件。在 hotmail 中查看时工作正常,但在 Outlook 中 html 部分混乱。 Outlook 中似乎还添加了 html 部分作为附件?谁能看出下面的 MIME 有什么问题吗:
X-Mailer: PHP/5.2.0-8+etch16 MIME-version: 1.0 Content-Type: multipart/mixed;
boundary="=====25ac73ba0275de9f6675bba3f3960608" From: Paul
--=====25ac73ba0275de9f6675bba3f3960608 Content-Type: text/plain
Content-Transfer- Encoding: 8bit Test email: domain: test.co.uk
name: Paul email: [email protected] address: 123 tel: 123
enquiry: 123 PAGE SENT FROM: http://test.co.uk/index.html
--=====25ac73ba0275de9f6675bba3f3960608
Content-Type: text/html Content-Transfer-Encoding: 8bit
Test email
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<body bgcolor="#FFFFFF" text="#000000" link="#AAAAAA">
<div align="center">
<table border="0" cellpadding="4" cellspacing="4"
width="550" align="center" bgcolor="#FFFFFF"
style="border: 3px solid #555555;">
<tr>
<td align="center">
<!--<img src="" alt="" border="0" style="margin: 10px 0px;" />--></td>
</tr>
<tr>
<td><font face="Verdana, Arial, Helvetica,
sans-serif;"size="2"><strong><center>Test Message:</center>
</strong></font></td>
</tr>
</table>
</div>
</body>
</html>
--=====25ac73ba0275de9f6675bba3f3960608
Content-Type: application/msword; name="Test.doc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="Test.doc"
0M8R4KGxGuEAAA AAAAAAAAAAAAAAAAAAAAAAAAAA Shortened
--=====25ac73ba0275de9f6675bba3f3960608--
I have written some code which generates and sends an email with attachment. It works fine when viewing in hotmail but in Outlook the html portion is messed up. It also seems to be adding the html portion as an attachment in outlook? Can anyone see anything wrong with the MIME below:
X-Mailer: PHP/5.2.0-8+etch16 MIME-version: 1.0 Content-Type: multipart/mixed;
boundary="=====25ac73ba0275de9f6675bba3f3960608" From: Paul
--=====25ac73ba0275de9f6675bba3f3960608 Content-Type: text/plain
Content-Transfer- Encoding: 8bit Test email: domain: test.co.uk
name: Paul email: [email protected] address: 123 tel: 123
enquiry: 123 PAGE SENT FROM: http://test.co.uk/index.html
--=====25ac73ba0275de9f6675bba3f3960608
Content-Type: text/html Content-Transfer-Encoding: 8bit
Test email
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<body bgcolor="#FFFFFF" text="#000000" link="#AAAAAA">
<div align="center">
<table border="0" cellpadding="4" cellspacing="4"
width="550" align="center" bgcolor="#FFFFFF"
style="border: 3px solid #555555;">
<tr>
<td align="center">
<!--<img src="" alt="" border="0" style="margin: 10px 0px;" />--></td>
</tr>
<tr>
<td><font face="Verdana, Arial, Helvetica,
sans-serif;"size="2"><strong><center>Test Message:</center>
</strong></font></td>
</tr>
</table>
</div>
</body>
</html>
--=====25ac73ba0275de9f6675bba3f3960608
Content-Type: application/msword; name="Test.doc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="Test.doc"
0M8R4KGxGuEAAA AAAAAAAAAAAAAAAAAAAAAAAAAA Shortened
--=====25ac73ba0275de9f6675bba3f3960608--
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
标题看起来会很混乱。它们应该各占一行。您已经得到:
并且它们应该
用换行符将标题部分与内容部分(“测试电子邮件”)分开。
The headers would appear to be messed up. They should each be on a separate line. You've got:
and they should be
with a line break to separate the header section from the content section ('Test email').
不确定您是否有兴趣使用某人的邮件类,但这是一项正在进行的工作。目前它只支持php的mail()函数,但它正在为smtp开发。非常容易使用,当然它还支持附件。
http://code.google.com/p/intervademailer
Not sure if you're interested in using some one's mail class, but here is a work in progress. It only supports php's mail() function at the moment, but its being developed for smtp. Very easy to use, and it supports attachments of course.
http://code.google.com/p/intervademailer