问题
So would username@gtld be a valid email? As a practical example google is purchasing the gTLD "gmail". Obviously they can associate A records with that permitting you to just type http://gmail/
to access the site. But, are there any specs that prohibit them from associating MX records with that as well, allowing folks to give out an alternative address username@gmail?
I ask because I want to make sure our email validator is future proof and technically correct.
回答1:
I think I answered my own question. Section 3.4.1 of rfc5322 which defines a valid email address states:
addr-spec = local-part "@" domain [...] domain = dot-atom / domain-literal / obs-domain [...] The domain portion identifies the point to which the mail is delivered. In the dot-atom form, this is interpreted as an Internet domain name (either a host name or a mail exchanger name) as described in [RFC1034], [RFC1035], and [RFC1123]. In the domain-literal form, the domain is interpreted as the literal Internet address of the particular host.
"gmail" would be a valid domain and host name and thus someone@gtld is a valid email address.
来源:https://stackoverflow.com/questions/25982111/is-usernamegtld-a-valid-email-i-e-there-is-no-domain-portion-it-is-just-a