Modify stored mail contents?

Sami Ketola sami.ketola at dovecot.fi
Sun Jul 23 16:30:18 EEST 2017


> On 23 Jul 2017, at 16.14, Tom Hendrikx <tom at whyscream.net> wrote:
> 
> In general, you should not do this. When a message is stored using IMAP,
> it is immutable. The IMAP server also remembers things like size and
> assigns messages a unique ID, so mail readers that have already
> downloaded the message with that ID, don't have to download the whole
> message again to verify whether it's contents have magically changed.
> What you're suggesting is not simply compatible with IMAP standards.
> 
> The normal way of applying changes to messages is just like a mail
> client connecting to IMAP: create a new message and save it to the
> store, then delete the old one.

Just like that. But instead of using IMAP interface to do it, you can also do 
it with doveadm:

1. doveadm fetch mail
2. doveadm delete mail
3. modify fetched mail
4. doveadm import modified mail back

Simple as that. There is no other supported way to do it. Editing mail objects
on storage will break things.

Sami


More information about the dovecot mailing list