MIME“多部分/相关”结构和Apple Mail。这是一个错误吗?
我使用 PHP Zend 框架类 Zend_Mail 构建了一个电子邮件。有一个文本部分和一个 html 部分以及相关的内嵌图像。我也想附上一份 pdf 文件。
我的问题是关于哑剧结构。有两种可能的选择:
选项 1:
Content-Type: multipart/mixed
Content-Type: multipart/alternative
Content-Type: text/plain; charset=UTF-8
Content-Type: multipart/related
Content-Type: text/html; charset=UTF-8
Content-Type: image/jpeg
Content-Type: image/jpeg
Content-Type: image/png
Content-Type: application/pdf
选项 2:
Content-Type: multipart/related;
Content-Type: multipart/alternative;
Content-Type: text/plain; charset=utf-8
Content-Type: text/html; charset=utf-8
Content-Type: image/jpeg
Content-Type: image/jpeg
Content-Type: image/png
Content-Type: application/pdf
选项 2 由 Zend_Mail 构建,但 Apple Mail 应用程序无法识别 pdf。在 Thunderbird 3 和 Outlook 2007 中一切正常。只有在 Apple Mail 中,PDF 附件无法识别。
选项 1 在 Apple Mail、Thunderbord 和 Outlook 中适用。但是从 Zend 框架类 Zend_Mail 中获取这个结构会有点棘手。
这是 Apple Mail 中的错误还是选项 2 不规范?
亲切的问候, 锡
I build a E-Mail with PHP Zend Framework Class Zend_Mail. There is one text- and one html-part with related inline-images. I want to attach one pdf-file too.
My question is about the mime-structure. Two options are possible:
option 1:
Content-Type: multipart/mixed
Content-Type: multipart/alternative
Content-Type: text/plain; charset=UTF-8
Content-Type: multipart/related
Content-Type: text/html; charset=UTF-8
Content-Type: image/jpeg
Content-Type: image/jpeg
Content-Type: image/png
Content-Type: application/pdf
option 2:
Content-Type: multipart/related;
Content-Type: multipart/alternative;
Content-Type: text/plain; charset=utf-8
Content-Type: text/html; charset=utf-8
Content-Type: image/jpeg
Content-Type: image/jpeg
Content-Type: image/png
Content-Type: application/pdf
option 2 is built by Zend_Mail, but the pdf is not recognized at Apple Mail Application. It's fine in Thunderbird 3 and Outlook 2007. Only in Apple Mail the PDF-Attachment isn't recognized.
option 1 is ok in Apple Mail, Thunderbord and Outlook. But it would be a little bit tricky to get this structure out of the Zend Framework Class Zend_Mail.
Is this a Bug in Apple Mail or is option 2 not normative?
kind regards,
sn
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否尝试过指定类型?请参阅此页面 http://framework.zend.com/manual/en/ zend.mail.attachments.html
我用这个
Have you tryied specifying the type ? see this page http://framework.zend.com/manual/en/zend.mail.attachments.html
i use this
这两个选项都违反了 RFC822,标题行必须从其行的第一个字符开始;这很重要,因为听者折叠是由第一个字符为空格 SP (#32) 或 HT (#09)、IIRC 触发的。
示例:
和
完全等价。
执行您(显然)尝试的操作的正确方法是使用边界属性,如下所示:
nested-portion 的一部分将包含 PDF 附件。
参考:
http://www.faqs.org/rfcs/rfc2822.html 和链接此处提供:电子邮件标头是否大小写敏感吗?
Both options are violations of RFC822, the header-lines MUST start on the first character of their line; this is important because hearer-folding is triggered by that first character being whitespace SP (#32) or HT (#09), IIRC.
Example:
and
are exactly equivalent.
The proper way to do what you're (apparently) attempting is by using the boundary attribute is something like this:
One of the parts of nested-portion would contain the PDF-attachment.
Ref:
http://www.faqs.org/rfcs/rfc2822.html and the links provided here: Are email headers case sensitive?