On 3.9.2012, at 17.11, Jost Krieger wrote:
imap(x1234567): Error: Cached message size larger than expected (6796 > 2844)
This looks like it does. Existing emails must not be changed, IMAP protocol forbids it (and Dovecot internals don't support it either). The only safe way to drop attachments is to assign a new UID for the mail, which basically means saving a new message without attachments and deleting the old one. The Content-Length header doesn't really have anything to do with this error.
Sorry if I was unclear. This is exactly what the plugin does. It builds a new message, starting with the old message and leaving out the unwanted attchment(s). Then it saves the new message, deletes the old message and finally copies over the flags.
I had a look at the handling of "Content-Length" in dovecot and had the impression that a new header was added but the old was not removed (if formally ok) and on reading the first header wins. But I'm not sure, of course.
Any Content-Length header sent by IMAP client or via LDA input should always get dropped (among some other headers) and replaced with the correct value. So if there's a bug, I doubt it has anything to do with that. But if you can easily reproduce this failure it would be nice to get it fixed..