What is the longest possible email address? [duplicate]

家住魔仙堡 提交于 2019-12-09 02:15:24

问题


Possible Duplicate:
Exceeding Max Email Address Sizes

Is there a technical limitation to how long email addresses can be? Are there practical limitations imposed by the different major email providers out there (Google, Microsoft, etc.)?

De jure or de facto, is there a limit on the number of characters in an email address?


回答1:


What is the maximum length of an email address?

254 characters

"This arises from the simple arithmetic of maximum length of a domain (255 characters) + maximum length of a mailbox (64 characters) + the @ symbol = 320 characters. Wrong. This canard is actually documented in the original version of RFC3696. It was corrected in the errata. There's actually a restriction from RFC5321 on the path element of an SMTP transaction of 256 characters. But this includes angled brackets around the email address, so the maximum length of an email address is 254 characters." - Dominic Sayers

-> https://web.archive.org/web/20130710170052/http://www.eph.co.uk/resources/email-address-length-faq/




回答2:


De jure:

There are multiple limits, on each part of an address.

RFC5322 specifies that mail lines MUST be less than 998 characters, which would put an upper limit on addresses a bit shorter than that (need to include the command as well).

But RFC5321 specifies:

4.5.3.1.1.  Local-part

The maximum total length of a user name or other local-part is 64
octets.

4.5.3.1.2.  Domain

The maximum total length of a domain name or number is 255 octets.

4.5.3.1.3.  Path

The maximum total length of a reverse-path or forward-path is 256
octets (including the punctuation and element separators).

So, 64 octets for username, 254 for <username@domain>.

De facto:

You can test compliance yourself with plus-syntax. Email yourself at yourusername+whateveryouwant@yourdomain.



来源:https://stackoverflow.com/questions/7717573/what-is-the-longest-possible-email-address

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!