Skip to content

Instantly share code, notes, and snippets.

@meaku
Created March 12, 2018 20:12
Show Gist options
  • Save meaku/e391c9c68fa052a1e4604e7e3e67d699 to your computer and use it in GitHub Desktop.
Save meaku/e391c9c68fa052a1e4604e7e3e67d699 to your computer and use it in GitHub Desktop.
# set default Maildir
MAILDIR="$HOME/Maildir"
# check if we're called from a .qmail-EXT instead of .qmail
import EXT
if ( $EXT )
{
# does a vmailmgr user named $EXT exist? if yes, deliver mail to his Maildir instead
CHECKMAILDIR = `dumpvuser $EXT | grep '^Directory' | awk '{ print $2 }'`
if ( $CHECKMAILDIR )
{
MAILDIR="$HOME/$CHECKMAILDIR"
}
}
test -d "$MAILDIR/.Junk" || maildirmake "$MAILDIR/.Junk"`
MAXSPAMSCORE="1"
# process SPAM
if (/^X-Rspamd-Bar:[^x]*?\+{$MAXSPAMSCORE,}$/)
{
MAILDIR="$MAILDIR/.Junk"
cc "$MAILDIR";
`find "$MAILDIR/new/" -mindepth 1 -maxdepth 1 -type f -printf '%f\0' | xargs -0 -I {} mv "$MAILDIR/new/{}" "$MAILDIR/cur/{}:2,S"`
exit
}
# Default:
to "$MAILDIR"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment