[Dovecot] manipulating mails

Sven spamagent at gmx.de
Thu Apr 15 19:44:45 EEST 2010


Hi all,

sorry for my inexperience. I am still learning. I searched for a while 
but found nothing useful.
I am looking for the best way to manipulate headers, bodies, 
attachments, locations, folders and/or flags while using deliver and 
e.g. perl.
In other words manipulating the whole mail in respect of the 
requirements of the LDA, MUA and User.
I see two diffent ways.

As i understand I can work via IMAP and pre-auth sessions, which keeps 
track of the index files from dovecot and handles complications with 
users already logged in.
Can I use e.g. some perl imap module -> download the mail -> change it 
-> upload it again with all other parameters unchanged and no confusions 
on the user's side?
This way I think its complex to rewrite the mail header/body/attachments 
as desired and keep everything else, eg times, flags, headers. the goal 
should be close to invisibility for a user.
This maybe leads to open pre-authed sockets/ports and a lot of work.

The other way would be to directly modify the file system.
This keeps everything (i think), but changes mtime and needs some index 
file and MUA cache update.
For performance reasons I would like to not use the index-automatism of 
dovecot but do it manualy at runtime of some script.
How does the index update gets initialized from the outside?
Same for the client cache.
Is there some command available or is a IMAP login my workaround?
This maybe leads to password problems or open pre-authed sockets/ports.

Last question:
Is it possible to add some received-tag to a mail-header when appending 
mails via imap to the mailbox?

Can anyone turn my head in the desired direction?
Thanks in advance
Sven



More information about the dovecot mailing list