[Dovecot] Passing info from mail process to mail_filter plugin script?

Charles Cazabon charlesc-dovecot at pyropus.ca
Sat Sep 21 20:32:40 EEST 2013

Hi, all,

The mail_filter plugin allows you to pass messages through an external
script/command on the way into and out of the Maildir/mbox/etc mail store.
With the recent/new version of the plugin, this seems to work correctly.

However, my mail-filter script (for filtering messages on the way from the
mail store through the IMAP process to a remote client) needs some extra info
from the IMAP mail process.  I'm having difficulty figuring out how this can
be accomplished.

Ideally, I'd like to pass another open file descriptor (opened in the IMAP
process) to the script, but I'm not sure if this is possible.  Opening the
file in the IMAP main.c fails, presumably due to file descriptor limits, but I
don't see where restrict_fd_limit() is called there.

My second choice for passing this info would be in an environment variable or
argument to the mail filter script.  Adding env_put() to the IMAP code doesn't
seem to get the value passed to the script, presumably because the environment
is getting cleared, but again I'm not certain where the list of env vars to
keep is set here.

There may be another way to accomplish this that I'm not thinking of?

Any assistance would be appreciated.

Charles Cazabon
GPL'ed software available at:               http://pyropus.ca/software/

More information about the dovecot mailing list