4 messages in net.sourceforge.lists.courier-maildropRe: [maildropl] courier-maildrop rule...
FromSent OnAttachments
Jorge Salamero SanzOct 14, 2005 4:36 am 
Jay LeeOct 14, 2005 7:38 am 
Jorge Salamero SanzOct 14, 2005 7:58 am 
moussOct 14, 2005 3:34 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [maildropl] courier-maildrop rules in mysql dbActions...
From:Jay Lee (jl@pbu.edu)
Date:Oct 14, 2005 7:38:33 am
List:net.sourceforge.lists.courier-maildrop

Jorge Salamero Sanz said:

i have a virtual domain system doing the mail delivery with courier-maildrop. the .mailfilter file now includes a file with per user rules: LOGNAME=tolower($LOGNAME) `test -e $LOGNAME` if ( $RETURNCODE != 0 ) { `maildirmake $LOGNAME` `maildirmake $LOGNAME/._spam` } `test -f $LOGNAME/mailfilter` if ( $RETURNCODE == 0 ) { include "$LOGNAME/mailfilter" } if ( /^X-Spam-Status: YES */) { to "$LOGNAME/._spam" } else { to "$LOGNAME/" }

now i'd like to have these rules in a mysql db so each user could edit his rules thru a simple web frontend.

Interesting idea, I'd never thought of this. Would make modify rules much easier since their in a db and no need to worry about FS permissions, etc.

what do you think should be the best way to do this ?

a perl script querying the database included in each user filter rules ? modify maildrop source to query the database ?

thanks !

I would say have mysql cli pull the rules from the global maildroprc file, then there is no need to create indiv. user .mailfilter files:

`echo "SELECT mailfilter FROM users where username = '$USER'" | mysql -s -u myuser -pmypass mydatabase > $HOME/myfilter` exception { include "$HOME/myfilter" } `rm -f $HOME/myfilter`

This should pull the rules out of mysql each time, write them to myfilter file, execute and then remove the rules. The one problem I can see with this code is two deliveries by maildrop to the same account in which case myfilter will get hit, so you should figure out a way to make the name unique each time, that way two maildrop processes will not be contending for the same file.