Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is the right domain length? #655

Open
michaeljota opened this issue Apr 26, 2017 · 5 comments
Open

What is the right domain length? #655

michaeljota opened this issue Apr 26, 2017 · 5 comments
Labels

Comments

@michaeljota
Copy link

According to this guy the domain length should be 254 chars at most, but the isEmail function it's checking for a 256 chars length, that is was once considered ok, but it seems like it was an errata

Which one is correct?

@chriso
Copy link
Collaborator

chriso commented Jun 22, 2017

It sounds like it should be 254.

@chriso chriso closed this as completed in 8f2b0ac Jun 22, 2017
@korvent
Copy link

korvent commented Oct 22, 2018

You misunderstood.
It is said:

What is the length of an email address?
The correct answer seems to be in the errata with ID 1690 from RFC 3696:
"[...] the upper
limit on address lengths should normally be considered to be 254."

This does not concern the length of the domain part but the entire email address.

Furthermore there is an error in this errata:
RFC 2821 says (https://tools.ietf.org/html/rfc2821#page-17):

RCPT TO:<forward-path> [ SP <rcpt-parameters> ] <CRLF>
The first or only argument to this command includes a forward-path
(normally a mailbox and domain, always surrounded by "<" and ">"
brackets) identifying one recipient.

and (https://tools.ietf.org/html/rfc2821#page-55):

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

so the total length of forward-path (the email address) is well 256 and not 254.

Concerning the domain length:
RFC 3696 says (https://tools.ietf.org/html/rfc3696#page-5):

A complete, fully-qualified, domain name must
not exceed 255 octets.

RFC 2821 says (https://tools.ietf.org/html/rfc2821#page-55):

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

In summary:

References
https://tools.ietf.org/html/rfc3696#page-5
https://tools.ietf.org/html/rfc2821#page-17
https://tools.ietf.org/html/rfc2821#page-55

@chriso chriso reopened this Oct 22, 2018
@ezkemboi
Copy link
Member

I will try to do more investigation on how to solve this bug.

@sakhmedbayev
Copy link
Contributor

It seems it supports only 64 characters long domain parts, so it supports the same length for both local and domain parts???

@WikiRik
Copy link
Member

WikiRik commented Dec 14, 2022

The 'domain part' is allowed to be longer than 64 characters, see the following part of the source code;

if (options.ignore_max_length === false && (
!isByteLength(user, { max: 64 }) ||
!isByteLength(domain, { max: 254 }))
) {
return false;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants