I have been writing SMTP-aware and MIME-aware code recently and have come across something I'd like you're collective opinions about.
What started it all was noticing that Outlook Express mis-decodes faulty quoted-printable. Basically, a quoted-printable "soft line break" is an = followed by a CRLF (in that order). If the LF is missing, OE displays the =, but discards the CR and the next character.
Now, I've recently co-written an IMAP server that talks to a database as it's message store. My colleague wrote the SMTP import script (in Perl). Everything we wrote assumes sane line boundaries. In the meantime, I discovered a warning in the Perl documentation against using a mere \\n for network work, especially under Unix, because line boundaries in text-oriented network protocols are supposed to be \\r\\n or CRLF. In fact, RFC 822 (SMTP) is reasonably clear about this. And so is 2045 and 2046 (MIME).
But what I've discovered is that some programs seem to deliver SMTP with just LF on the line-boundaries. I'm not totally sure, mind, as the only evidence I have to go on is the output from the import script which is run from PostFix's mailbox_command option. Actually, it would be highly ironic if the culprit proved to be OE (sending, that is) because it would mean OE is not compatible with itself! OTOH, most of the offending emails have also passed through PostFix on the sending end and through another install of PostFix here on the receiving end. I rather doubt PostFix would be the culprit here, but it's looking likely. I haven't found any configuration options that might be relevant.
I guess what I'm asking is how prevalent is the missing CR in network protocol implementations? Or is PostFix just doing something a little wierd? (We've got a fix in our import script; it just forces all line boundaries to CRLF.)
Wade.