Indy10 - 电子邮件地址中的编码词
Indy10 - Encoded words in email address
我遇到过一些在电子邮件地址中包含编码字词的电子邮件,例如而不是
abc <abc@example.com>
它包含:
abc <=?ISO8859-1?B?YWJjQGV4YW1wbGUuY29t=?=>
我看到很多电子邮件程序都有问题,但有一些没有,这让我觉得它可能是某些 RFC 的一部分,尽管我找不到它。
此外,如果电子邮件地址 header 的格式为:
From: =?ISO8859-1?B?YWJjQGV4YW1wbGUuY29t=?=
它会被许多程序解码,但不会被 Indy 解码。在大多数程序中发生的情况是,他们认为该部分是 From "name" 部分并对其进行解码,但他们对电子邮件地址进行了编码,从而导致:
Name = abc@example.com
Email = =?ISO8859-1?B?YWJjQGV4YW1wbGUuY29t=?=
这使得它至少部分地得到了很好的解码。
然而在 Indy 中这会导致:
Name = **blank**
Email = =?ISO8859-1?B?YWJjQGV4YW1wbGUuY29t=?=
Indy 是否应该支持它(或者相反,它将 base64 部分视为 "name" 部分,而不是 "email" 部分),或者它是一个格式不正确的电子邮件地址?或者这是一个解释问题,什么应该被解释为第一部分,因为电子邮件确实看起来像 From: abc@example.com
没有 <>
个字符。
abc <=?ISO8859-1?B?YWJjQGV4YW1wbGUuY29t=?=>
根据 RFC 2047 Section 5 Use of encoded-words in message headers:
,Indy 不支持此类编码地址
An 'encoded-word' may appear in a message header or body part header according to the following rules:
(1) An 'encoded-word' may replace a 'text' token (as defined by RFC 822) in any Subject or Comments header field, any extension message header field, or any MIME body part field for which the field body is defined as '*text'. An 'encoded-word' may also appear in any user-defined ("X-") message or body part header field.
Ordinary ASCII text and 'encoded-word's may appear together in the same header field. However, an 'encoded-word' that appears in a header field defined as '*text' MUST be separated from any adjacent 'encoded-word' or 'text' by 'linear-white-space'.
(2) An 'encoded-word' may appear within a 'comment' delimited by "(" and ")", i.e., wherever a 'ctext' is allowed. More precisely, the RFC 822 ABNF definition for 'comment' is amended as follows:
comment = "(" *(ctext / quoted-pair / comment / encoded-word) ")"
A "Q"-encoded 'encoded-word' which appears in a 'comment' MUST NOT contain the characters "(", ")" or " 'encoded-word' that appears in a 'comment' MUST be separated from any adjacent 'encoded-word' or 'ctext' by 'linear-white-space'.
It is important to note that 'comment's are only recognized inside "structured" field bodies. In fields whose bodies are defined as '*text', "(" and ")" are treated as ordinary characters rather than comment delimiters, and rule (1) of this section applies. (See RFC 822, sections 3.1.2 and 3.1.3)
(3) As a replacement for a 'word' entity within a 'phrase', for example, one that precedes an address in a From, To, or Cc header. The ABNF definition for 'phrase' from RFC 822 thus becomes:
phrase = 1*( encoded-word / word )
In this case the set of characters that may be used in a "Q"-encoded 'encoded-word' is restricted to: <upper and lower case ASCII letters, decimal digits, "!", "*", "+", "-", "/", "=", and "_" (underscore, ASCII 95.)>. An 'encoded-word' that appears within a 'phrase' MUST be separated from any adjacent 'word', 'text' or 'special' by 'linear-white-space'.
These are the ONLY locations where an 'encoded-word' may appear. In particular:
An 'encoded-word' MUST NOT appear in any portion of an 'addr-spec'.
An 'encoded-word' MUST NOT appear within a 'quoted-string'.
An 'encoded-word' MUST NOT be used in a Received header field.
An 'encoded-word' MUST NOT be used in parameter of a MIME
Content-Type or Content-Disposition field, or in any structured
field body except within a 'comment' or 'phrase'.
Indy(和 RFC 2047)确实支持编码名称,但是:
From: =?ISO8859-1?B?YWJj?= <abc@example.com>
From: =?ISO8859-1?B?YWJjQGV4YW1wbGUuY29t=?=
在这种情况下,Indy 会将其解释为没有姓名的电子邮件地址。并且如上所述,不允许使用编码地址。
我遇到过一些在电子邮件地址中包含编码字词的电子邮件,例如而不是
abc <abc@example.com>
它包含:
abc <=?ISO8859-1?B?YWJjQGV4YW1wbGUuY29t=?=>
我看到很多电子邮件程序都有问题,但有一些没有,这让我觉得它可能是某些 RFC 的一部分,尽管我找不到它。
此外,如果电子邮件地址 header 的格式为:
From: =?ISO8859-1?B?YWJjQGV4YW1wbGUuY29t=?=
它会被许多程序解码,但不会被 Indy 解码。在大多数程序中发生的情况是,他们认为该部分是 From "name" 部分并对其进行解码,但他们对电子邮件地址进行了编码,从而导致:
Name = abc@example.com
Email = =?ISO8859-1?B?YWJjQGV4YW1wbGUuY29t=?=
这使得它至少部分地得到了很好的解码。
然而在 Indy 中这会导致:
Name = **blank**
Email = =?ISO8859-1?B?YWJjQGV4YW1wbGUuY29t=?=
Indy 是否应该支持它(或者相反,它将 base64 部分视为 "name" 部分,而不是 "email" 部分),或者它是一个格式不正确的电子邮件地址?或者这是一个解释问题,什么应该被解释为第一部分,因为电子邮件确实看起来像 From: abc@example.com
没有 <>
个字符。
abc <=?ISO8859-1?B?YWJjQGV4YW1wbGUuY29t=?=>
根据 RFC 2047 Section 5 Use of encoded-words in message headers:
,Indy 不支持此类编码地址An 'encoded-word' may appear in a message header or body part header according to the following rules:
(1) An 'encoded-word' may replace a 'text' token (as defined by RFC 822) in any Subject or Comments header field, any extension message header field, or any MIME body part field for which the field body is defined as '*text'. An 'encoded-word' may also appear in any user-defined ("X-") message or body part header field.
Ordinary ASCII text and 'encoded-word's may appear together in the same header field. However, an 'encoded-word' that appears in a header field defined as '*text' MUST be separated from any adjacent 'encoded-word' or 'text' by 'linear-white-space'.
(2) An 'encoded-word' may appear within a 'comment' delimited by "(" and ")", i.e., wherever a 'ctext' is allowed. More precisely, the RFC 822 ABNF definition for 'comment' is amended as follows:
comment = "(" *(ctext / quoted-pair / comment / encoded-word) ")"
A "Q"-encoded 'encoded-word' which appears in a 'comment' MUST NOT contain the characters "(", ")" or " 'encoded-word' that appears in a 'comment' MUST be separated from any adjacent 'encoded-word' or 'ctext' by 'linear-white-space'.
It is important to note that 'comment's are only recognized inside "structured" field bodies. In fields whose bodies are defined as '*text', "(" and ")" are treated as ordinary characters rather than comment delimiters, and rule (1) of this section applies. (See RFC 822, sections 3.1.2 and 3.1.3)
(3) As a replacement for a 'word' entity within a 'phrase', for example, one that precedes an address in a From, To, or Cc header. The ABNF definition for 'phrase' from RFC 822 thus becomes:
phrase = 1*( encoded-word / word )
In this case the set of characters that may be used in a "Q"-encoded 'encoded-word' is restricted to: <upper and lower case ASCII letters, decimal digits, "!", "*", "+", "-", "/", "=", and "_" (underscore, ASCII 95.)>. An 'encoded-word' that appears within a 'phrase' MUST be separated from any adjacent 'word', 'text' or 'special' by 'linear-white-space'.
These are the ONLY locations where an 'encoded-word' may appear. In particular:
An 'encoded-word' MUST NOT appear in any portion of an 'addr-spec'.
An 'encoded-word' MUST NOT appear within a 'quoted-string'.
An 'encoded-word' MUST NOT be used in a Received header field.
An 'encoded-word' MUST NOT be used in parameter of a MIME Content-Type or Content-Disposition field, or in any structured field body except within a 'comment' or 'phrase'.
Indy(和 RFC 2047)确实支持编码名称,但是:
From: =?ISO8859-1?B?YWJj?= <abc@example.com>
From: =?ISO8859-1?B?YWJjQGV4YW1wbGUuY29t=?=
在这种情况下,Indy 会将其解释为没有姓名的电子邮件地址。并且如上所述,不允许使用编码地址。