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
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.
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 characters
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.