breaking long header lines into 2 (or more) lines

Darac Marjal mailinglist at darac.org.uk
Tue Apr 24 11:58:47 UTC 2018


On Tue, Apr 24, 2018 at 10:06:49AM +0200, Matthias Apitz wrote:
>
>Hello,
>
>Long header lines can be split into 2 or more lines and the 2nd line
>must start with a blank (is TAB allowed too). Is there any rule (RFC) at
>which char the split is allowed or not allowed? For example, can mail
>addr lines be broken at any point like this one:
>
>To: mutt-users at mut
> t.org
>
>I did tests before asking and such a case like the one with mutt-users at mutt.org
>above is arriving fine and the line is put together somewhere in the MTA
>chain.

RFC 5322 (which obsoletes RFC2822, which obsoletes RFC822) defines the 
format of "Internet Messages" (i.e. e-mails). The relevant section of it 
is section 2.2.3 "Long Header Fields" 
https://tools.ietf.org/html/rfc5322#section-2.2.3

2.2.3.  Long Header Fields

   Each header field is logically a single line of characters comprising
   the field name, the colon, and the field body.  For convenience
   however, and to deal with the 998/78 character limitations per line,
   the field body portion of a header field can be split into a
   multiple-line representation; this is called "folding".  The general
   rule is that wherever this specification allows for folding white
   space (not simply WSP characters), a CRLF may be inserted before any
   WSP.

   For example, the header field:

   Subject: This is a test

   can be represented as:

   Subject: This
    is a test

      Note: Though structured field bodies are defined in such a way
      that folding can take place between many of the lexical tokens
      (and even within some of the lexical tokens), folding SHOULD be
      limited to placing the CRLF at higher-level syntactic breaks.  For
      instance, if a field body is defined as comma-separated values, it
      is recommended that folding occur after the comma separating the
      structured items in preference to other places where the field
      could be folded, even if it is allowed elsewhere.

   The process of moving from this folded multiple-line representation
   of a header field to its single line representation is called
   "unfolding".  Unfolding is accomplished by simply removing any CRLF
   that is immediately followed by WSP.  Each header field should be
   treated in its unfolded form for further syntactic and semantic
   evaluation.  An unfolded header field has no length restriction and
   therefore may be indeterminately long.

>
>Thanks for any pointer?
>
>	matthias
>-- 
>Matthias Apitz, ✉ guru at unixarea.de, http://www.unixarea.de/ +49-176-38902045
>Public GnuPG key: http://www.unixarea.de/key.pub



-- 
For more information, please reread.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 906 bytes
Desc: not available
URL: <http://lists.mutt.org/pipermail/mutt-users/attachments/20180424/3210259a/attachment.asc>


More information about the Mutt-users mailing list