PHP 邮件 - MIME 组合

发布于 2024-11-05 15:59:14 字数 1779 浏览 0 评论 0原文

我编写了一些代码来生成并发送带有附件的电子邮件。在 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">&nbsp;
    <!--<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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

番薯 2024-11-12 15:59:14

标题看起来会很混乱。它们应该各占一行。您已经得到:

Content-Type: text/html Content-Transfer-Encoding: 8bit 
Test email  

并且它们应该

Content-Type: text/html
Content-Transfer-Encoding: 8bit 

Test email  

用换行符将标题部分与内容部分(“测试电子邮件”)分开。

The headers would appear to be messed up. They should each be on a separate line. You've got:

Content-Type: text/html Content-Transfer-Encoding: 8bit 
Test email  

and they should be

Content-Type: text/html
Content-Transfer-Encoding: 8bit 

Test email  

with a line break to separate the header section from the content section ('Test email').

为你鎻心 2024-11-12 15:59:14

不确定您是否有兴趣使用某人的邮件类,但这是一项正在进行的工作。目前它只支持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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文