Is there a way to modify mail messages when they are downloaded using a special login. eg. my normal login for dovecot is martijn at youngguns.nl but when I log in using martijn at 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. Martijn
On Aug 14, 2008, at 11:12 AM, <martijn at youngguns.nl> <martijn at 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 at youngguns.nl but when I > log in > using martijn at 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). -------------- next part -------------- A non-text attachment was scrubbed... Name: PGP.sig Type: application/pgp-signature Size: 194 bytes Desc: This is a digitally signed message part URL: <http://dovecot.org/pipermail/dovecot/attachments/20080814/aee7d5ee/attachment-0002.bin>
Timo Sirainen wrote:> On Aug 14, 2008, at 11:12 AM, <martijn at youngguns.nl> > <martijn at 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 at youngguns.nl but when I >> log in >> using martijn at 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