邮件多部分/替代对多部分/混合 [英] Mail multipart/alternative vs multipart/mixed

查看:175
本文介绍了邮件多部分/替代对多部分/混合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

创建电子邮件时,您应该设置 Content-Type multipart / alternative when发送TEXT和附件时,发送HTML和TEXT或 multipart / mixed

When creating email messages you are supposed to set the Content-Type to multipart/alternative when sending HTML and TEXT or multipart/mixed when sending TEXT and attachments.

所以如果你想要做什么发送HTML,文本和附件?使用两个?

So what do you do if you want to send HTML, Text, and attachments? Use both?

推荐答案

使用第一部分的 multipart / mixed multipart / alternative 以及附件的后续部分。反过来,在 multipart / alternative中使用 text / plain text / html / code> part。

Use multipart/mixed with the first part as multipart/alternative and subsequent parts for the attachments. In turn, use text/plain and text/html parts within the multipart/alternative part.

有能力的电子邮件客户端应该会识别 multipart / alternative 部分和显示文本部分或HTML部分必要。它还应该显示所有后续部分作为附件。

A capable email client should then recognise the multipart/alternative part and display the text part or html part as necessary. It should also show all of the subsequent parts as attachment parts.

这里要注意的重要事情是,在多部分MIME消息中,将零件部分。在理论上,这种嵌套可以延伸到任何深度。任何合理的电子邮件客户端应该能够递归地处理所有消息部分。

The important thing to note here is that, in multipart MIME messages, it is perfectly valid to have parts within parts. In theory, that nesting can extend to any depth. Any reasonably capable email client should then be able to recursively process all of the message parts.

这篇关于邮件多部分/替代对多部分/混合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆