Ángel González writes:
On Wed, 20-08-2014, Sam Varshavchik wrote: > text files always used a single linefeed newline terminator. > An email message is a plain text file. > I don't think this needs any documentation.> maildirs originated with Qmail. There's quite a bit of history there. Qmail,> like every other sane Linux/Unix software, stored mail in plain text files. I understand there are historical reasons for courier to use LF-emails.Note however that rfc 2822/5322 explicitely state that lines must end in CRLF, further supported by the rfcs of the transmission protocols (SMTP, POP, IMAP…).
Let's read the first sentence of RFC 5322. This document specifies the Internet Message Format (IMF), a syntax for text messages that are sent between computer users, within the framework of "electronic mail" messages.The wording is very deliberate, and precise. It does not claim to define how these messages are ultimately stored, and in which format; only what format they exist when they "are sent". This was also essentially the same wording in RFC 2822.
Other documents then incorporate them by reference. For SMTP, RFC 2821: A companion document [RFC-2822] discusses message headers, message bodies and formats and structures for them, and their relationship.RFC 2822/5322 does not declare how email messages are stored in files, if they're stored in files at all. Exchange, for example, stores them in a database. Obviously, you can't say that RFC 2822/5322 has any relevance there. All that RFC 2822/5322 does is set a baseline for an email message format. Other documents, such as RFC2821 for SMTP, and RFC3501 for IMAP, incorporate this format by reference.
I am not aware of any documentation that purports to apply RFC 2822/5322 to messages in maildirs. Qmail, originally, simply received messages via SMTP, stripped off the CRs, and stored them in maildirs, as plain text files with LF-terminated lines, just like any other text file on Unix or Linux. And, of course, when sending mail, the CRs get put back.
Of course, Courier-IMAP does a lot of work to put them back, when sending a message, or parts of it, to a client that asks for it; with a lot of sweat and pain in order to conform with IMAP's strict requirements regarding byte counts of various parts of the message, that are based on CRLF-terminated text. It's not as simple as just tacking on a CR before each LF. A client may, for example, request partial contents of a message with a starting byte offset that points to either the CR or the LF; or which end at one or the other.
In fact it would have been simpler for the server if the files used CRLF, as itwouldn't need to reencode them, worry about virtual & phisical offsets, etc
The problem is that the IMAP server does not exist in a vacuum. It comes as a shock to some people when I explain to them that an IMAP server plays no part in email delivery, but only in accessing existing mail that something else delivered to a mailbox.
It would've been quite simple for Courier-IMAP not to do any of that, but just assume that all mail must be CRLF-terminated from the start. Were that the case, nobody would've been able to use it, 15+ years ago.
And if you came up to Mr. Dan Bernstein, 17-or-so years ago, wich such a proposition, I am pretty sure at what reaction you would've gotten out of him, with that idea.
It's fairly established that message files in maildirs use LF-terminated text, and it's up to whoever writes mail to maildirs to ensure that they do. If something doesn't, then it should be fixed. Of course, there's nothing wrong with changing all the other stuff so that it could handle that, but the burden isn't there, it's on the stuff that's broken in the first place.
Like I said, I haven't yet looked at this fully, but, as I see so far, it appears to either tweak RFC822.HEADERS only – if so, then the other dozen- odd FETCH items still wouldn't be able to handle such mail, which is bad – or the corresponding byte counts will be off. In which case it will be a protocol violation, and very bad.
pgpZIU2NTpQQb.pgp
Description: PGP signature
------------------------------------------------------------------------------ Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/
_______________________________________________ Courier-imap mailing list [email protected] Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-imap
