哪些电子邮件标头字段可以包含参数?
我试图找出电子邮件解析库中可以有哪些通用子例程。
我知道两个经常带有参数的 MIME 字段:(
Content-Type: application/x-stuff;
title*=us-ascii'en-us'This%20is%20%2A%2A%2Afun%2A%2A%2A
示例来自 https://www.rfc- editor.org/rfc/rfc2231)
和
Content-Disposition: attachment; filename=genome.jpeg;
modification-date="Wed, 12 Feb 1997 16:29:51 -0500";
(示例来自 https://www.rfc-editor.org/rfc/rfc2183)
它们是唯一的 - 或者这是一个通用机制? https://www.rfc-editor.org/rfc/rfc822仅谈论“结构化”字段 - 上面的字段肯定是“结构化”的,但 rfc822 中的示例是关于地址字段的 - 这是一个不同的结构 - 列表地址。
I am trying to find out what universal subroutines can I have in an email parsing library.
I know of two MIME fields that often take parameters:
Content-Type: application/x-stuff;
title*=us-ascii'en-us'This%20is%20%2A%2A%2Afun%2A%2A%2A
(example from https://www.rfc-editor.org/rfc/rfc2231)
and
Content-Disposition: attachment; filename=genome.jpeg;
modification-date="Wed, 12 Feb 1997 16:29:51 -0500";
(example from https://www.rfc-editor.org/rfc/rfc2183)
Are they the only ones - or is this an universal mechanism? https://www.rfc-editor.org/rfc/rfc822 only talks about 'structured' fields - the fields above are 'structured' for sure, but the example in rfc822 is about an address field - which is a different structure - list of addresses.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
据我所知,电子邮件中还有两个 MIME 字段:
一个没有参数,
一个也没有。
没有通用的“MIME头字段参数规则”,只需查找每个头字段的标准定义即可。
(编辑:)添加原始问题后,您当然可以使用通用子例程。请注意,电子邮件标头解析是一项重要的任务(参见 RFC 2822)。我想到了这些通用子例程:
但是,所有这些当然都存在于许多开源库中。
There are two more MIME fields in email as far as I know:
which has no parameters, and
has none, either.
There is no general "MIME header field parameter rule", just look up the standard definition for each header field.
(EDIT:) After your additions to the original question, you can of course use universal subroutines. Be warned that email heaader parsing is a nontrivial task (cf. RFC 2822). These universal subroutines come into my mind:
However, all this exists in many open source libraries of course.
Received: 标头通常是结构化的,尽管规范相当模糊并且没有认真的标准化工作。最接近事实上的标准的是 Sendmail,Postfix 或多或少地模仿了它。 DKIM 签名的结构非常巧妙。 SpamAssassin插入的ad hoc header有一个结构;它告诉您为什么邮件被归类为垃圾邮件。还有很多,但这应该给你一些可以开始咀嚼的东西。此处的示例均未使用 Mime Content-xxx 语法。
The Received: header is typically structured, although the spec is rather vague and there is no serious standardization effort. The closest thing resembling a de facto standard is Sendmail, which is mimicked more or less closely by Postfix. The DKIM signature is structured, in a fairly clever way. The ad hoc header inserted by SpamAssassin has a structure; it tells you why a message was classified as spam. There are oodles more, but this should give you something to start chewing. None of the examples here use the Mime Content-xxx syntax.