View Full Version : Maildrop filter
beef_yo
04-03-2005, 12:40 AM
I'm having a bit of difficulty getting maildrop to do what I want it to to - I grabbed a script off a website that filters mail marked as spam into a user's folder called '.spam'.
However when I add the line to the script into the domain's .qmail-defaults directory mail no longer gets delivered at all.
I'd rather not go into the script that I used as it wasn't written for a QMT installation anyway, instead I wondered if anyone had any suggestions as to the best way to accomplish this kind of thing on a QMR install.
Any hints?
nianderson
04-13-2005, 10:03 AM
did you ever get that figured out?
lukav
04-18-2005, 01:45 PM
I've noticed that there is no post to that problem so here is what works for me:
I've just setup this and it seams to work for now.
I've set ip up to use .qmail-default for delivering to users that doesn't have their own filters setup. If the user have setup a mailfilter then the same file can be included in the user filter.
1. create a global mailfilter file touch /home/vpopmail/domains/mailfilter
2. change the owner of the file: chown vpopmail.vchkpw /home/vpopmail/domains/mailfilter
3. Edit the file: vi /home/vpopmail/domains/mailfilter
Here is the content:
SHELL="/bin/bash"
import EXT
import HOST
VPOP="| /home/vpopmail/bin/vdelivermail '' bounce-no-mailbox"
VHOME=`/home/vpopmail/bin/vuserinfo -d $EXT@$HOST`
VDOMHOME=`dirname "$VHOME"`
#logfile "/home/vpopmail/domains/mailfilter.log"
DUMMY=`test -d $VHOME/Maildir/`
if ( $RETURNCODE == 0 )
{
DUMMY=`test -d $VHOME/Maildir/.Spam`
if ( $RETURNCODE == 1 )
{
# log "Createing spam directory $VHOME/Maildir"
DUMMY=`/usr/local/bin/maildirmake -f Spam $VHOME/Maildir/`
# log "$RETURNCODE"
DUMMY=`echo INBOX.Spam >> $VHOME/Maildir/courierimapsubscribed`
}
}
if ( /^X-Spam-Status: Yes/ )
{
to "$VHOME/Maildir/.Spam"
# log "Message delivered to $VHOME/Maildir/.Spam"
}
else
{
DUMMY=`test -f $VDOMHOME/.qmail-$EXT`
if ( $RETURNCODE == 1 )
{
to "$VPOP"
}
}
4. Change the .qmail-default for the domain to
| /var/qmail/bin/preline /usr/local/bin/maildrop /home/vpopmail/domains/mailfilter
That's it.
If some user have it's own filter implemented by creating .qmail-[user] file that pipes to maildrop, make sure the user filter includes the global filter:
include "/home/vpopmail/domains/mailfilter"
I've personaly have installed serversidefilter plugin for squirellmail and have tweaked it to include the file automaticaly.
Hope this helps.
Regards
rickh925
06-02-2005, 01:32 PM
Lukav, I'm trying to get the latest ServerSidePlugin running on my QMR installation and am having problems. Basically, I did the basic install following the README in the serversidefilter directory. The filter shows up in SquirrelMail's Options. I can add a filter, but they don't seem to be written to the disk as they are gone if I leave and come back to the rule configuration again.
If I try the test.sh in the script folder, I get this:
[root@fedora2 script]# ./test.sh
IMAP username: test@mydomain.com
IMAP password: xxxxxxxx
Can't find uid/gid for user
RESULT: 11
Can't find uid/gid for user
RESULT: 11
Can't find uid/gid for user
RESULT: 11
If you do not need to perform additional tests, remove the file test_creds
Remove now? (Y/n): y
I get the same error in my var/log/httpd/error_log. Do you have any idea about this error?
larskman
06-23-2005, 03:59 PM
Did anyone get this working?
rickh925
06-23-2005, 05:09 PM
I gave up on this and just hand created the filters. I don't have but a dozen users and most only care about having their spam moved into a Junk Email folder. The others, I just hand code as the users ask for the rules. Not very maintainable, but it works on such a small scale.
vBulletin® v3.6.8, Copyright ©2000-2009, Jelsoft Enterprises Ltd.