2 ms·
An email address is max 40 characters long. That one always baffles me.
by franze 4y ago
An email address is max 40 characters long. That one always baffles me.
- dspillett 4y agoUsually limits like this come from someone defining a DB column for the value without specifying a length, and the DBMS default being taken. Someone (maybe the same someone) then comes along and adds validation to the input form which forces values to fit in this limited space. This can vary by tool too. With SQL Server the default for an [N]VARCHAR value if not length is specified is 30 characters (this means CAST/CONVERT can unexpectedly truncate without error which sometimes causes interesting problems to debug), though if you are creating a table in some of the standard tools many of them default to 50. Though scanning the RFCs to verify other comments in this thread I note that local-part has a 64-byte limit which I was not aware of (or once knew but have forgotten). And it is explicitly stated as 64 octets not 64 characters, so beware of the possibility of non-ASCII characters when validating (I suspect many regexs attempting to validate addresses will get this wrong or not enforce it at all).