[Dovecot] should dovecot store maildir files with CRLF or LF?

Christoph Anton Mitterer calestyo at scientia.net
Wed May 22 05:06:23 EEST 2013


On Wed, 2013-05-22 at 02:54 +0100, Ben Morrow wrote:
> Mail sent by SMTP has to have CRLF line endings. (Unless you're using
> BINARYMIME, but I don't think that's at all widely implemented yet.) If
> your mailserver accepts LF-only line endings it ought to translate them
> into CRLF before sending the message on.
Sure, and I assume postfix does the later... but what's mandatory for
SMTP isn't a "standard/recommendation/best-practise/etc" on what IMAP
servers should do internally.


> What line endings is the POP server sending? Can you verify this without
> involving Evolution?
Yeah... guess I should teach myself speaking POP3 as well ;)

> Is the POP server Dovecot or something else?
no idea... that's the one of my ISP...


> The original (djb) definition of Maildir assumed that messages would be
> written to the maildir with LF line endings, and both MTA and POP server
> would translate back to CRLF as needed. Dovecot (as a POP server) can
> deal with messages in either format, and should always return them to
> clients with CRLF.
> 
> > When the client however received it via IMAP, before in turn moving it
> > on via IMAP into Dovecot, then the maildir file is mixed CRLF and LF,
> > i.e. the body is CRLF, the headers are terminated...
> 
> IMAP is similar, in that line endings on the wire are always supposed to
> be CRLF; it's a little more complicated in that clients can also upload
> messages. If I APPEND a message with mixed line endings to a Maildir
> Dovecot mailbox, the message is written to the Maildir with LF-only
> endings and comes back over IMAP with CRLF-only.
IIRC such mixing is forbidding by the most recent RFC defining the
format of internet mail messages... neither CR nor LF is allowed to
exist (which was allowed to in the old standards and then didn't mean a
newline, but rather the character CR respectively LF for itself).

This is also the reason why I wonder a bit what Dovecot is doing, cause
if it's compliant, then the outside world should always only see CRLF
now, right?

=> But then it makes no sense to store mixed CRLF / LF / CR, if a buggy
client presents it with that via IMAP.

=> It does IMHO however make sense to consider whether it may store
mails in LF-only(! no mixing)... when this is the platform's native
end-of-line marker.

=> On the other hand; I'd prefer to have this homogenous... so at least
when dovecot get's new mail via IMAP, I would recommend it should use
generally CRLF and - one would need to think about the following more
carefully - convert and single LF / CR to it.
Whether it can/should do such conversation with mail picked up from new/
respectively the LDA/MDA... is another topic... but if possible, I'd do
so as well.

Timo, if you read along, what do you think?


> Can you confirm what is actually being sent over the wire?
You mean when Dovecot re-exports the stuff via IMAP? Haven't checked
that yet..



Cheers,
Chris.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5113 bytes
Desc: not available
URL: <http://dovecot.org/pipermail/dovecot/attachments/20130522/32aa36f8/attachment.bin>


More information about the dovecot mailing list