Configure maildrop mailfilters
parent
f5da6428eb
commit
e7087baf9e
@ -0,0 +1,57 @@
|
|||||||
|
# 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 their Maildir instead
|
||||||
|
VUSER_DIRECTORY = `dumpvuser $EXT | grep '^Directory' | awk '{ print $2 }'`
|
||||||
|
if ( $VUSER_DIRECTORY )
|
||||||
|
{
|
||||||
|
MAILDIR="$HOME/$VUSER_DIRECTORY"
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
# no VUSER_DIRECTORY found, so let's check for a catchall
|
||||||
|
CATCHALL_TARGET = `dumpvuser + | grep '^Forward: ' | awk '{ print $2 }'`
|
||||||
|
if ( $CATCHALL_TARGET )
|
||||||
|
{
|
||||||
|
# there is a catchall mailbox, retrieve its directory
|
||||||
|
VUSER_DIRECTORY = `dumpvuser $CATCHALL_TARGET | grep '^Directory' | awk '{ print $2 }'`
|
||||||
|
if ( $VUSER_DIRECTORY )
|
||||||
|
{
|
||||||
|
MAILDIR="$HOME/$VUSER_DIRECTORY"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# check if the spam score is higher than our threshold
|
||||||
|
if ( /^X-Rspamd-Bar: \+{$MOVESCORE,}$/ )
|
||||||
|
{
|
||||||
|
# yes, move to Spam folder and exit
|
||||||
|
|
||||||
|
SPAMFOLDER="$MAILDIR/.Spam"
|
||||||
|
|
||||||
|
# make sure the spam folder actually exists
|
||||||
|
`test -d "$SPAMFOLDER"; or maildirmake "$SPAMFOLDER"`
|
||||||
|
|
||||||
|
to "$SPAMFOLDER"
|
||||||
|
# 'to' implies 'exit'
|
||||||
|
}
|
||||||
|
|
||||||
|
# forward to addresses from vmailmgr config
|
||||||
|
VUSER_FORWARD = `dumpvuser $EXT | grep '^Forward: ' | awk '{ print $2 }' | tr '\n' ' '`
|
||||||
|
if ( $VUSER_FORWARD )
|
||||||
|
{
|
||||||
|
cc "!$VUSER_FORWARD"
|
||||||
|
}
|
||||||
|
|
||||||
|
# ensure that the vmailmgr user has mailbox delivery enabled
|
||||||
|
VUSER_HAS_MAILBOX = `dumpvuser $EXT | grep '^Has-Mailbox: ' | awk '{ print $2 }'`
|
||||||
|
VUSER_MAILBOX_ENABLED = `dumpvuser $EXT | grep '^Mailbox-Enabled: ' | awk '{ print $2 }'`
|
||||||
|
if ( "$VUSER_HAS_MAILBOX" eq "false" || "$VUSER_MAILBOX_ENABLED" eq "false" )
|
||||||
|
{
|
||||||
|
log "Local mailbox delivery explicitly disabled for this address"
|
||||||
|
EXITCODE=100 # hard error
|
||||||
|
exit
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
# config
|
||||||
|
MOVESCORE=5 # minimum spam score to move the email to the Spam folder
|
||||||
|
MAILDIR="$HOME/users/lukas" # default Maildir
|
||||||
|
|
||||||
|
{% include '_common.j2' %}
|
||||||
|
|
||||||
|
to "$MAILDIR"
|
||||||
|
# 'to' implies 'exit'
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
# config
|
||||||
|
MOVESCORE=5 # minimum spam score to move the email to the Spam folder
|
||||||
|
MAILDIR="$HOME/users/lukas" # default Maildir
|
||||||
|
|
||||||
|
{% include '_common.j2' %}
|
||||||
|
|
||||||
|
if ( $MAILDIR =~ /\/lukas$/ )
|
||||||
|
{
|
||||||
|
# deliver GitHub notifications to the Kirby folders
|
||||||
|
|
||||||
|
`test -d "$MAILDIR/.Kirby2"; or maildirmake "$MAILDIR/.Kirby2"`
|
||||||
|
`test -d "$MAILDIR/.Kirby3"; or maildirmake "$MAILDIR/.Kirby3"`
|
||||||
|
|
||||||
|
if( /^List-Archive: https:\/\/github.com\/getkirby-v2\// )
|
||||||
|
{
|
||||||
|
MAILDIR="$MAILDIR/.Kirby2"
|
||||||
|
}
|
||||||
|
|
||||||
|
if( /^List-Archive: https:\/\/github.com\/getkirby\// )
|
||||||
|
{
|
||||||
|
MAILDIR="$MAILDIR/.Kirby3"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
to "$MAILDIR"
|
||||||
|
# 'to' implies 'exit'
|
||||||
Loading…
Reference in New Issue