Line Length in an Email Message

Posted on 2005-05-05
Last Modified: 2012-05-05
I am trying to send out an HTML email without any line breaks in it and was wondering if there is a limit to the length of a line when sending through an SMTP server, is it 1024 characters, and if so can anyone point me to an RFC that covers this just so I can point it out to the higher ups?
Question by:wyogirl77
    LVL 19

    Accepted Solution

    RFC 2822 is your baby:

    "2.1.1. Line Length Limits

       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."
    LVL 19

    Expert Comment

    I would say it is a different ball game altogether. RFC 822 is for plain vanilla mails. It doesnt talk about line lengths etc at all. The consideration of like length is actually the worry of trasport protocols such as SMTP.

    Sophistication was added when standards for SMTP protocol was developed and it was in the specification of SMTP that this line length limit was set. RFC for SMTP clearly states that:

    "In particular, a significant portion of the Internet community wishes to
       exchange messages in which the content body consists of a MIME
       message [3] containing arbitrary octet-aligned material. This memo
       uses the mechanism described in [5] to define an extension to the
       SMTP service whereby such contents may be exchanged. Note that this
       extension does NOT eliminate the possibility of an SMTP server
       limiting line length; servers are free to implement this extension
       but nevertheless set a line length limit no lower than 1000 octets."

    In the light of this line length limitation imposed by SMTP, mail clients needed a mechanism to transfer data longer in length than allowed as well as other content types such as embedded documents and attachments. To facilitate transfer of such data over a protocol like SMTP which restricted the length of each line that could be transferred, a way out was required. This requirement was fulfilled when the MIME extensions came into play. The RFC for MIME (RFC 1521) addresses the issue.

    RFC 1521 suggest the use of CONTENT-TRANSFER and CONTENT-ENCODING headers. These headers put together specify how complex data such as embedded documents and attachment would be transferred over a transport protocol that was orginally developed for transferrring 7-bit ASCII data.

    I recoomend you take a loook at RFC 1521 to understand this better. It would help further if you have the source of a few message in front of you while studying the RFC.
    LVL 19

    Expert Comment

    RFC 822 is the older version and has since been superceded by RFC 2822.  You have to think of RFCs as a time-line with the higher the number being the more recent.  RFC 1521 (MIME Part 1) and it's sibling RFCs 1522 are extensions on RFC 822 (along with others).  RFCs 1521 & 1522 have been superceded by RFCs 2045, 2046, 2047, 2048 and 2049.  RFC 2822 does it's best to hone the problems faced with non-conformant practices and solidify the possible components to fit the SMTP protocol.  Any message not conforming to RFC 2822 should consider itself binary in composition and thereby fall under the more recent RFC 3030 (which obsoletes RFC 1830): - SMTP Service Extensions for Transmission of Large and Binary MIME Messages.

    To form an anology, the MIME protocols give protocol on how to create an envelope whereas RFC 2822 gives the protocol on what dimensions of envelope can fit through the letterbox of SMTP (RFC 2821).

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    This article is essential to make secure Yahoo Mail connection without facing any issue. It is providing simple steps to configure your Yahoo Mailbox to Hard drive using Microsoft Outlook.
    This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    732 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

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now