What is the maximum length of a valid email id
-
320
And the segments look like this
{64}@{255}
64 + 1 + 255 = 320
You should also read this if you are validating emails
http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx
Nathan : However according to this spec (for student loan data) http://www.nchelp.org/elibrary/ESC/CommonRecord-CommonLineDocumentation/CRC-Ver_1-3-0-PDF.pdf on page 20: "The e-mail length changed to reflect current ANSI standards. The E-mail address is a maximum length of 128 characters." Hmm.Nathan : Can you reference what RFC you got this from?Carl : Here's a lovely article dispelling various myths about email including "max len == 320". The limit is actually 254.Bob : Where is the lovely article?Dominic Sayers : He may mean this: http://www.dominicsayers.com/isemail -
64 for the local part (the account/name) and 255 for the domain. I think the
@sign will be counted extra so that sums to 320.But caution: this is only the length of the real address. An address may contain a display name. Such an address looks like
first last <local@domain>and will often extend 320.Dominic Sayers : But you will be sending the email over SMTP, so the address has to fit into the forward-path field, which has a maximum length of 256 characters. Also note that it will have angle brackets round it in this field so that actual address (including the @) can be no more than 254 characters.Dominic Sayers : More here: http://www.dominicsayers.com/isemail -
You may want to consult: RFC 821.
I'm not sure if this RFC has been superseded by another RFC. According to my math it makes the longest email address 129 characters.
user - 64 characters domain - 64 characters at-sign - 1 character ------------------------ total - 129 charactersTim Stewart : Here's an interesting article: http://www.eph.co.uk/resources/email-address-length-faq/Dominic Sayers : RFC 821 was suerseded by RFC 2821 which was then superseded by RFC 5321. This was back before either of us had a goatee. See http://www.dominicsayers.com/isemail -
The original version of RFC 3696 did indeed say 320 was the maximum length, but John Klensin subsequently accepted this was WRONG.
The maximum length is specified in RFC 5321: "The maximum total length of a reverse-path or forward-path is 256 characters"
RFC 3696 was corrected here
I note for the record that John Klensin may actually be wrong in his correction: a Path is defined as
Path = "<" [ A-d-l ":" ] Mailbox ">"So the Mailbox element (i.e. the email address) has angle brackets around it to form a Path, so the Mailbox must be no more than 254 characters to keep the path under 256.
I've now collated test cases from Cal Henderson, Dave Child, Phil Haack, Doug Lovell and RFC 3696. 158 test addresses in all.
I ran all these tests against all the validators I could find. The comparison is here: http://www.dominicsayers.com/isemail
I'll try to keep this page up-to-date as people enhance their validators. Thanks to Cal, Dave and Phil for their help and co-operation in compiling these tests and constructive criticism of my own validator.
People should be aware of the errata against RFC 3696 in particular. Three of the canonical examples are in fact invalid addresses.
Álvaro G. Vicario : To sum up: the maximum length of an email address is **254** characters, as stated in http://www.dominicsayers.com/isemail/
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.