[Dovecot] manipulating mails

Steffen Kaiser skdovecot at smail.inf.fh-brs.de
Fri Apr 16 11:11:28 EEST 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, 15 Apr 2010, Sven wrote:

> i want to move mails from some specific imap folder to some other folder on 
> the filesystem to precess them further more.
> but maybe i want to copy the mail and then set the seen flag.
> i think both can be done via imap,
> but maybe i want to add some tag/keyword, text or attachment from some 
> processing skript with processing informations
> thinks getting more complex ...

In IMAP storage messages are immutable, per spec. That means: You cannot 
transparently change the content of a message, e.g. add/remove headers or 
(parts of) the body, once the message has been delivered.

If you do it the IMAP way, each manipulated messages (I mean the content, 
not the keywords/tags/flags) becomes a new message, hence, the clients 
might download it again.

If you keep that in mind, you can successfully manipulate the content of 
messages in Maildir by:

1) rename message somewhere else,
2) manipulate it
3) rename it to maildir_mailbox/tmp
4) adjust access permissions
5) rename it to maildir_mailbox/new or ../cur
making sure the file gets a new filename stem (part of filename before the 
colon) than it had originally.

If a new file pops up in cur/new, Dovecot assumes a non-Dovecot delivery 
and re-indexes the file next time the user accesses the mailbox.

To manipulate the flags I would use PREAUTH.

You can savly remove files from a Maildir.

Regards,

- -- 
Steffen Kaiser
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iQEVAwUBS8gbtL+Vh58GPL/cAQL5TQf+KOzTvYLPiTLSitOhd4IOawjb9B9+U/Fe
jHi4XpgGk4ubs22CQ7yUD6v2ozzRMjqIKDPFvvBvJfRW84G1zB3aj2p6lE0QN7XP
ekWhuVkUHSbKwPCcxXvZAXTBv8/nPD45+mz32JyqHVZA/2QG0FDayM6d4mUg29AR
EdGxNXd/1SzO12xHAqe+kG3EzhUTY5p3U1/Bfg8YlXutUyIQ+qK9rrEPsuLfWDOy
ZdnKCohvR13lq92MJiXosuN56kC8kGsSHj/YVhsdIhNpDP61YE2uuRqJtxd8Ynpu
3VnLFZHIg1dv4GDFgaZP6ul3e7YShVZUgAyZLxCiglL6rBqk3KKnFw==
=mG0U
-----END PGP SIGNATURE-----


More information about the dovecot mailing list