-->

What is the longest possible email address? [dupli

2020-08-09 06:36发布

问题:

This question already has answers here:
Closed 8 years ago.

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.