[Dovecot] Feature Request: content-filter / MOVE scripts

Timo Sirainen tss at iki.fi
Mon May 14 00:11:20 EEST 2007

On Thu, 2007-04-19 at 08:07 -0700, Daniel L. Miller wrote:
> 1.  Have a dedicated "content-filter" functionality built-in to 
> Dovecot.  Under this model, Dovecot.conf would include at least three 
> FILTER-FOLDER-OUT-SCRIPT.  Whenever a message is moved into or out of a 
> folder ending in SUFFIX the appropriate SCRIPT is called, with the 
> arguments above being passed.

This has been suggested several times earlier also. I think I was
planning on implementing this as some kind of a plugin ("ext-events"?)
which would have its own configuration file, something like:

copy {
  # * being the default for both source/dest
  source_mailbox = *
  dest_mailbox = Spam
  # command gets the mail from stdin
  command = /usr/bin/teach-spam.sh
copy {
  source_mailbox = Spam
  command = /usr/bin/teach-ham.sh

There could be other events as well each having their own filter
settings. Instead of command there could also be a "pipe" or a "socket"

> In any case, I figure it's best to prevent any message processing by 
> Dovecot itself - so while it might be nice to define a list of headers 
> to send to the scripts, instead of the whole message, that's probably 
> not appropriate for Dovecot to focus on.  On the other hand, any of the 
> above options would probably benefit from a MAXIMUM_FILTER_SIZE 
> parameter to limit the maximum message size.

It's easy to get a list of specific headers, so that could be a setting

But as for when this plugin in general gets implemented, I don't know.
It's not really a priority for me right now. If someone wants to try
implementing it, mail-log plugin is a great place to start since it
already contains all the hooking code. You'd just need to make it read a
config file (see src/auth/db-sql.c for example), check if an event
matches configured events and then call the configured command instead
of just logging the event.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://dovecot.org/pipermail/dovecot/attachments/20070514/28e61f35/attachment.pgp 

More information about the dovecot mailing list