电子邮件地址中的前导下划线?

时间:2012-02-08 20:27:40

标签: email-validation rfc

为了找出电子邮件地址本地部分中的前导下划线是否可以接受,我会参考哪些RFC?

示例:_johndoe@hotmail.com

当然,这个问题也适用于任何领先的特殊角色。

我在维基百科中找到了这一行,但在RFC本身内找不到任何参考。我在这里错过了什么吗?

本地部分 电子邮件地址的本地部分可以使用任何这些ASCII字符RFC 5322第3.2.3节:

2 个答案:

答案 0 :(得分:19)

引用RFC5322。

第3.4.1节说:

An addr-spec is a specific Internet identifier that contains a
locally interpreted string followed by the at-sign character ("@",
ASCII value 64) followed by an Internet domain.  The locally
interpreted string is either a quoted-string or a dot-atom.

回到3.2.3,你得到:

atext       =   ALPHA / DIGIT /    ; Printable US-ASCII
                   "!" / "#" /        ;  characters not including
                   "$" / "%" /        ;  specials.  Used for atoms.
                   "&" / "'" /
                   "*" / "+" /
                   "-" / "/" /
                   "=" / "?" /
                   "^" / "_" /
                   "`" / "{" /
                   "|" / "}" /
                   "~"

atom           =   [CFWS] 1*atext [CFWS]

dot-atom-text  =   1*atext *("." 1*atext)

dot-atom       =   [CFWS] dot-atom-text [CFWS]

[CFWS]表示评论或空白。

因此,电子邮件地址的第一部分可以是点原子,而点原子又以atext开头,可以是下划线。

是的,电子邮件地址可以以下划线开头。

答案 1 :(得分:3)

该RFC的第3.4.1节定义了地址的指定方式,并引用了3.2.3节中定义的内容。没有什么可以禁止领导" _"。