Maximum length of "subject line" and body of an email

Posted on 2002-03-06
Last Modified: 2008-02-01
We need to store the content of incoming emails in
our database.

For determining the proper column lengths we need
to know how many characters a subject line and the
body of an email can contain (maximum values).

In RFC 821/822 I did not find a specification for that.
Question by:Lewis
  • 5
LVL 24

Expert Comment

ID: 6845203
Subject line, I don't recall we had to expand ours, tho'. Might be best to go as near 255 as you are comfortable. Many cases the line is truncated before recipient sees it anyway.

For text, It seems to go on forever. At least one client (Lotus) and one server truncate inconsistently around 64 KB. Best IMO is either go with known limits, if internal EM, or to allow it to be open-ended, if open to the world.

I also think your rfc references are old (<1000) and without looking I'd guess they've been superceded by now (with minor changes for modern world).
LVL 24

Expert Comment

ID: 6845209
fwiw, we had to also expand the field for sender. THey are now being inhuman, long unique numbers to refect the recipients, for list maintenance.
LVL 24

Expert Comment

ID: 6845348
Beware, that eMail itself can fall under a variety of protocols. That said,

822 has no such limit, the way I read it, it is not geared for filesytems or databases, but for terminal I/O. It does not use character counters (as you seek) or fixed or max length, but pre-agreed-to terminators (effectively infinite, in and of itself, fo your context); sample quote:


        Each header field may be represented on exactly one line  con-
        sisting  of the name of the field and its body, and terminated
        by a CRLF; this is what the parser sees.  For readability, the
        field-body  portion of long header fields may be "folded" onto
        multiple lines of the actual field.  "Long" is commonly inter-
        preted  to  mean greater than 65 or 72 characters.  The former
        length serves as a limit, when the message is to be viewed  on
        most  simple terminals which use simple display software; how-
        ever, the limit is not imposed by this standard.
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

LVL 24

Expert Comment

ID: 6845412
821 gives similar answer, and calls for 7-bit ascii:
"         Without some provision for data transparency the character
         sequence "<CRLF>.<CRLF>" ends the mail text and cannot be sent
         by the user.

"The mail data may contain any of the 128 ASCII characters."

"The maximum total length of a text line including the <CRLF> is 1000 characters (but not counting the leading dot duplicated for transparency)."

The intent is that the message is not terminated through other than keyboard sequence, thus under user's discretionary control. Friendly. For RFCs, the 'C' is for Comment, not rule, they are more guidelines agreed to than fixed rules enforced by a big-brother. Since messages were typed, sizes were constrained by users getting tired of typing. This was prior to modern methods of pasting in files like Excel spreadsheets into the middle of a message. Internet was using FTP to move files around at the time, then permitted them to be attached (not embedded, as many in this topic area attempt).
LVL 24

Accepted Solution

SunBow earned 100 total points
ID: 6845462
About a year ago 821 & 822 were (Y2K) superceded by 2821 & 2822, FYI if a glutton for details. Sample 2822:

"There are two limits that this standard places on the number of characters in a line. Each line of characters MUST be no more than 998 characters, and SHOULD be no more than 78 characters, excluding the CRLF."

Note that for database purposes, one can define field as 'line' with multiple occurences.

Subject line is not structured, as such it falls under 2.2.1:

"2.2.1. Unstructured Header Field Bodies

   Some field bodies in this standard are defined simply as
   "unstructured" (which is specified below as any US-ASCII characters,
   except for CR and LF) with no further restrictions.  These are
   referred to as unstructured field bodies.  Semantically, unstructured
   field bodies are simply to be treated as a single line of characters
   with no further processing (except for header "folding" and
   "unfolding" as described in section 2.2.3).

(you already have the quote on what is constraint for a single line)
LVL 44

Expert Comment

ID: 7401197
Hello Lewis

this question is open for more then 2 months
time to clean up
if not stated otherwise

my recom will be
-points to SunBow
-this will be finalized by an EE Moderator
-with no further update (09.11.2002)


posted by ToolzEE v1.0

Expert Comment

ID: 7405116
Question has been closed as per recommendation

JGould-EE Moderator

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How do I determine the virus in this email? 5 169
iPhone Mail: manually checking ALL email 3 68
Opera UI gone nuts 4 66
How to remove this tool bar in Outlook Mail. 6 32
In this article we will discuss some EI Capitan Mail app issues and provide some manual process to resolve them.
Check out this infographic on what you need to make a good email signature that will work perfectly for your organization.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question