flashmob / go-guerrilla

Mini SMTP server written in golang
MIT License
2.77k stars 365 forks source link

Local-part length #204

Open viruthagiri opened 4 years ago

viruthagiri commented 4 years ago

I noticed this part.

// The maximum total length of a user name or other local-part is 64
// however, here we double it, since a few major services don't respect that and go over
LimitLocalPart = 64 * 2

RFC 821 Section 4.5.3 says,

There are several objects that have required minimum maximum sizes. That is, every implementation must be able to receive objects of at least these sizes, but must not send objects larger than these sizes.

      ****************************************************
      *                                                  *
      *  TO THE MAXIMUM EXTENT POSSIBLE, IMPLEMENTATION  *
      *  TECHNIQUES WHICH IMPOSE NO LIMITS ON THE LENGTH *
      *  OF THESE OBJECTS SHOULD BE USED.                *
      *                                                  *
      ****************************************************

        user

           The maximum total length of a user name is 64 characters.

RFC 2821 and 5321 says the same thing.

For receiving servers 64 characters local-part is a soft limit. i.e. A receiving server MUST support AT LEAST 64 maximum characters.

VERP and SRS requires more than 64 characters in the local-part.
https://en.wikipedia.org/wiki/Variable_envelope_return_path https://en.wikipedia.org/wiki/Sender_Rewriting_Scheme

Original: <user@domain.com>

VERP: <bounces+user=domain.com@alioth-lists.debian.net>

SRS: <SRS0=2wQu=2C=alioth-lists.debian.net=bounces+user=domain.com@bounce.secureserver.net>

128 character may sound reasonable, it's not enough for SRS in some cases.

You can read my I-D which I published couple of months back. https://tools.ietf.org/html/draft-viruthagiri-email-address-length-01

My suggestion is stick to the overall length defined in LimitPath constant. i.e. 256. LimitLocalPart and LimitDomain should have 254 as value. i.e. You allocate 1 char for @ symbol and 1 for the minimum possible char in local-part or domain.

Or provide a config to override both LimitLocalPart and LimitDomain.

Gmail supports upto 900 characters in email address without any local-part or domain limitation.

Hope that helps.

viruthagiri commented 4 years ago

@ret394

I hope you mean these links.

https://www.rfc-editor.org/errata/eid1003 https://www.rfc-editor.org/errata/eid1690

viruthagiri commented 4 years ago

Sorry. Here it is.

The labels must follow the rules for ARPANET host names. They must start with a letter, end with a letter or digit, and have as interior characters only letters, digits, and hyphen. There are also some restrictions on the length. Labels must be 63 characters or less.

https://tools.ietf.org/html/rfc1034#section-3.5

viruthagiri commented 4 years ago

Just to give some more info.

RFC 5321 says, The maximum total length of a domain name or number is 255 octets. My proposal removes that limitation in email address. It means if an email address length is 500 characters, then the maximum total length of a domain name is 498 ("n-2" characters).

I brought the RFC 1034 into the spec because I don't want people to think that they can have a 498 character string as domain without any dot.