Processing Maildir contents on message-by-message basis

Jeff Kletsky dovecot at allycomm.com
Thu Feb 12 06:21:57 UTC 2015


I (finally) moved over to Maildir storage here and would like to 
implement some "scripts" to manage taking actions on emails manually 
identified as misclassified as spam/ham. After reading through the 
Dovecot 2 description of how it works to try to see how it interacts 
with other processes changing the files.

I'm concerned that I would be corrupting the message indexes if I just 
go hog-wild and run the scripts on the filesystem, rather than through 
Dovecot in some way.

The types of actions taken would likely be:
* Select a message from a given mailbox (the "source")
* Potentially modify it drastically (remove spamassassin markup, for 
example)
* Pipe the modified message to a mail-delivery agent (still running 
procmail here) and/or to sa-learn
* Assuming successful completion of the pipe action(s), remove the 
source message from the mailbox

While I can use doveadm to do bulk move/delete actions, I don't see a 
clear way to iterate through a set of messages and perform actions on them.

First off, if I wrangle and mangle the message files directly, do I have 
to worry about the indexes, or do the indexes "magically" repair 
themselves in cases where the messages are either altered (including 
headers) or removed?

Have I missed a way to iterate over messages and process it using 
external tools using the dovecot tools?

Has this been discussed ad nauseum and I somehow missed it? (If so, for 
which I apologize profusely).

Thanks,

Jeff





More information about the dovecot mailing list