[Dovecot] problem with content-length and mbox parsing

Glenn Leavell glenn at usg.edu
Tue Nov 15 06:46:21 EET 2005


The stars aligned recently such that I sent someone a message that
contained a line similar to this in the message body:

 From glenn at usg.edu Thu Jun 20 16:48:11 2002

(Except that there wasn't that space character *before* the From; I've
added it here to avoid any problems with this message).

Dovecot wrote a copy of the message in my "sent mail" folder under the
direction of my imap client.  But when I went back to *read* that folder
(still through Dovecot), it was broken and was presented as two corrupted
mail messages.

About a year ago, there was a thread on the list about the fact that
Dovecot does not perform >From quoting when writing to mbox folders:

	http://dovecot.org/list/dovecot/2004-October/004865.html

Timo, in that thread you mentioned the following about Dovecot's use of the
content-length header:

On Tue, Oct 05, 2004 at 05:13:36PM +0300, Timo Sirainen wrote:
> Dovecot (and eg. mutt) uses Content-Length header to figure out how 
> large the message body is, so clients can't mess anything by sending 
> From-lines. Also Dovecot requires that From-line has correct syntax and 
> valid timestamp or it's not treated as From-line.

In the example above, the message *does* include a valid content-length
header after it is initially written, but Dovecot seems to ignore the
header when reading the folder, and it treats the "From " line in the body
as a message separator.  For example, a SELECT on the folder will return "2
EXISTS" even if the single message described above is the only message in
the folder.  I'm currently at CVS 20051104.

Glenn


More information about the dovecot mailing list