20

According to the question "What is the maximum length of a valid email address?", the maximum length of the address is 254. But I like to know what would be the maximum length of the display name:

Display Name <my@examplemailaddress.net>

Following this link https://www.ietf.org/mail-archive/web/ietf-822/current/msg00086.html the size is unlimited but practically according this link https://www.ietf.org/mail-archive/web/ietf-822/current/msg00088.html the size would be 72 characters. But I believe this answer is a bit outdated? What would be reasonable limit for today?

Community
  • 1
  • 1
Trendfischer
  • 7,112
  • 5
  • 40
  • 51

1 Answers1

11

If you ask the maximal length allowed by the specs (the normative source is RFC5322 as of current_timestamp) then, indeed, there is no limit, since folding allows you to have an unlimted length of any field (while still respecting the advised 78 [or the larger 998] character limit).

Practical limit is a very subjective question, since "practical" would be the length which is fully displayed by "most" clients and environments; now that's pretty hard to calculate.

I would say the upper limit of practicality would be the total length of 78 characters from the "From:" header up to the last ">" character of the email address, since longer ones may probably break up while displaying in almost all environments, which would give you around 40 characters to use even for longer email addresses.

Most clients, however, probably expects to display around 20-25 characters under normal circumstances.

These are all displayed characters and not the actual length in bytes of a whatever way encoded address (especially for long utf-8 codes).

Community
  • 1
  • 1
grin
  • 315
  • 4
  • 14
  • If a line should not be longer than 998 characters and the maximum length of an email address is 254, might the recommended maximum length for the display name be like 998 - 254 - 2 ("<>") - 6 ("From: ") = 736 ? – Trendfischer Nov 06 '18 at 13:46
  • @Trendfischer I guess recommendation should consider the displayability of the display name: it if's too long it won't be displayed, ever: I guess most client is simply unable to display strings longer than the allocated space for DN. What you wrote is based on a rather technical limit, but I see no practical reason for it: it's too long for humans (at least 9 "usual lines" long) and unnecessarily limited for machines. What is your purpose anyway? :-) – grin Nov 07 '18 at 20:10
  • 1
    When I asked the question four years ago, I had to set a maximum size for a database field for the display name. Then I had to set additional display names for system generated sender adresses based on locations with street names and additional infos. To generate these display names, I had to guess a practical limit. So both values are relevant, imho. – Trendfischer Nov 09 '18 at 08:16