Timo Sirainen wrote:
On Aug 14, 2008, at 11:12 AM, martijn@youngguns.nl martijn@youngguns.nl wrote:
Is there a way to modify mail messages when they are downloaded using a special login.
In theory, yes.
eg. my normal login for dovecot is martijn@youngguns.nl but when I log in using martijn@dosomething.youngguns.nl I would like to download my mail which are processed using a Perl script. The Perl script will modify the content of the message (the message body). So I don't want to change the header or IMAP flags.
There are some problems with that. You'd have to have separate index files for the accounts so that Dovecot won't return wrong cached values (or disable indexes for the other login). I think the plugin could work very much like the zlib plugin works now (override struct mail.get_stream()). Just make sure it always returns exactly the same output, because IMAP guarantees that the messages are immutable (and e.g. fetching RFC822.SIZE must match your modified message's size).
Another solution would be to maintain parallel mailboxes by whatever means and keep them in sync. This may not be as hard as it sounds depending on requirements? I think the "log" module might provide a starting point to make this really watertight?
Have you more details on your requirements? Is it a low bandwidth problem?
In my solution we simply enable a filter on incoming email and then keep a copy of the old email in an Archive folder http://www.mailasail.com
Good luck
Ed W