1

The RFC822/RFC2822 standard says that "Header fields are lines composed of a field name, followed by a colon (':'), followed by a field body, and terminated by CRLF".

But I see at least one RFC822 MIME parser that auto-normalizes payloads that use LF ("\n") into CRLF ("\r\n") before proceeding with parsing.

How safe is it to use an RFC822 format for serializing data that may have been hand-edited in places to use LF instead of CRLF? Would it be safe to send this data around to different programs & expect them to be able to parse it with various RFC822 parser libraries?

dan
  • 43,914
  • 47
  • 153
  • 254

1 Answers1

1

In the general case, not safe at all. Be conservative in what you send / generate.

Having said that, most Unix tools expect locally stored email files to use local line ending conventions. RFC5322 really only codifies the format used on the wire.

tripleee
  • 175,061
  • 34
  • 275
  • 318
  • It looks like MTAs like Postfix strip the CRs before it saves email to a user account in /var/mail/file or into mbox format. – dan Oct 01 '13 at 20:04