互联网电子邮件的最大消息ID长度 [英] Maximum internet email Message-ID length
问题描述
我正在寻找Internet Message-ID字段允许的最大字符长度,以便在应用程序中进行验证。我已经审查了诸如 RFC-2822 和维基百科 Message-ID 以及此SO问题,以及其他各个地方。我能找到的最接近答案是 998个字符,因为这是规范允许Internet消息中的每一行的最大长度(来自RFC-2822),并且Message-ID字段不能为多行。
I'm looking for the maximum character length allowed for an internet Message-ID field for validation purposes within an application. I've reviewed sources such as RFC-2822 and Wikipedia "Message-ID" as well as this SO question, among other various places. The closest answer I can find is "998 characters" because that is the maximum length that the specification allows for each line in an internet message (from RFC-2822), and the Message-ID field cannot be multiple lines.
998个字符是否是肯定的答案?没有这样的限制吗?
Is 998 characters the definitive answer? Is there no such limit?
推荐答案
如果我对电子邮件有一些了解,那一定是因为它分布广泛绒毛电子邮件软件的系统。也就是说,无论RFC怎么说,您都会发现违反它们的电子邮件,一些应对电子邮件的软件以及一些失败的电子邮件。我认为大多数人都会想到健壮性原则。
If there's one thing I've learned about email, it must be that it's a massively distributed system for fuzzing email software. That is, no matter what the RFCs say, you will find emails violating them, some email software coping and some failing. I think most will limp along with the robustness principle in mind.
这样,我认为符合RFC的Message-ID的最大长度为995个字符。
With that out of the way, I think the maximum RFC compliant Message-ID length is 995 characters.
每个RFC的最大行长您引用的是998个字符。该字段将包含 Message-ID:字段名称,但是您可以在字段名称和字段正文之间进行换行。然后,包含实际Message-ID的行将包含一个空格(折叠空白),<,Message-ID和>。在语义上,尖括号不是Message-ID的一部分。因此,您最终最多只能使用998-3 = 995个字符。
The maximum line length per the RFC you cite is 998 characters. That would include the "Message-ID:" field name, but you can do line folding between the field name and the field body. The line containing the actual Message-ID would then contain a space (the folding whitespace), "<", Message-ID, and ">". Semantically, the angle brackets are not part of the Message-ID. Therefore you end up with a maximum of 998 - 3 = 995 characters.
这篇关于互联网电子邮件的最大消息ID长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!