See RFC 5322: Internet Message Format and, to a lesser extent, RFC 5321: Simple Mail Transfer Protocol .
(请参阅RFC 5322:Internet邮件格式,以及在较小程度上的RFC 5321:简单邮件传输协议 。)
RFC 822 also covers email addresses, but it deals mostly with its structure:
(RFC 822也涵盖了电子邮件地址,但它主要涉及其结构:)
addr-spec = local-part "@" domain ; global address
local-part = word *("." word) ; uninterpreted
; case-preserved
domain = sub-domain *("." sub-domain)
sub-domain = domain-ref / domain-literal
domain-ref = atom ; symbolic reference
And as usual, Wikipedia has a decent article on email addresses :
(像往常一样,维基百科有一篇关于电子邮件地址的文章 :)
The local-part of the email address may use any of these ASCII characters:
(电子邮件地址的本地部分可以使用以下任何ASCII字符:)
- uppercase and lowercase Latin letters
A
to Z
and a
to z
; (大写和小写拉丁字母A
到Z
和a
到z
;)
- digits
0
to 9
; (数字0
到9
;)
- special characters
!#$%&'*+-/=?^_`{|}~
; (特殊字符!#$%&'*+-/=?^_`{|}~
;)
- dot
.
(点.
)
, provided that it is not the first or last character unless quoted, and provided also that it does not appear consecutively unless quoted (eg [email protected]
is not allowed but "John..Doe"@example.com
is allowed); (,除非引用,否则它不是第一个或最后一个字符,并且除非引用,否则它也不会连续出现(例如, [email protected]
不允许,但是“ "John..Doe"@example.com
[email protected]
是允许);)
- space and
"(),:;<>@[\]
characters are allowed with restrictions (they are only allowed inside a quoted string, as described in the paragraph below, and in addition, a backslash or double-quote must be preceded by a backslash); (空格和"(),:;<>@[\]
字符允许有限制(它们只允许在带引号的字符串中,如下段所述,此外,必须在前面加上反斜杠或双引号反斜杠);)
- comments are allowed with parentheses at either end of the local-part;
(本地部分两端的括号允许注释;)
eg john.smith(comment)@example.com
and (comment)[email protected]
are both equivalent to [email protected]
. (如john.smith(comment)@example.com
和(comment)[email protected]
都等同于[email protected]
。)
In addition to ASCII characters, as of 2012 you can use international characters above U+007F
, encoded as UTF-8 as described in the RFC 6532 spec and explained on Wikipedia .
(除ASCII字符外, 截至2012年,您可以使用U+007F
以上的国际字符 ,编码为UTF-8,如RFC 6532规范中所述,并在Wikipedia上进行了解释。)
Note that as of 2019, these standards are still marked as Proposed, but are being rolled out slowly. (请注意,截至2019年,这些标准仍然标记为建议,但正在缓慢推出。)
The changes in this spec essentially added international characters as valid alphanumeric characters (atext) without affecting the rules on allowed & restricted special characters like !#
and @:
. (此规范中的更改实际上将国际字符添加为有效的字母数字字符(atext),而不会影响允许和限制的特殊字符(如!#
和@:
:)的规则。)
For validation, see Using a regular expression to validate an email address .
(有关验证,请参阅使用正则表达式验证电子邮件地址 。)
The domain
part is defined as follows :
(domain
部分定义如下 :)
The Internet standards (Request for Comments) for protocols mandate that component hostname labels may contain only the ASCII letters a
through z
(in a case-insensitive manner), the digits 0
through 9
, and the hyphen ( -
).
(协议的Internet标准(Request for Comments)要求组件主机名标签可以仅包含ASCII字母a
到z
(以不区分大小写的方式),数字0
到9
以及连字符( -
)。)
The original specification of hostnames in RFC 952 , mandated that labels could not start with a digit or with a hyphen, and must not end with a hyphen. (RFC 952中主机名的原始规范,强制标签不能以数字或连字符开头,并且不得以连字符结尾。)
However, a subsequent specification ( RFC 1123 ) permitted hostname labels to start with digits. (但是,后续规范( RFC 1123 )允许主机名标签以数字开头。)
No other symbols, punctuation characters, or blank spaces are permitted. (不允许使用其他符号,标点字符或空格。)