dotfile
LOGFILE=$HOME/procmail.log
MAILDIR=$HOME/Mail
SCRATCHDIR=$HOME/Scratch/Mail
WHITELIST=$MAILDIR/.whitelist
yargoext=yargo+ext@SDFDOMAIN
yargoout=myname@EXAMPLE.COM
#
# first some cheap immediate filtering of high volume spam
:0 H
* ^To:.*myself@TAINTEDDOMAIN.COM
$SCRATCHDIR/SPAM
# direct external, first add some headers
:0 fH: extern
* yargo\+(ext|OTHERKEYWORD)@
| formail -c -I 'Envelope-From: yargo@SDFDOMAIN' -I "Envelope-To: $yargoout"
# then send it
:0 A
! $yargoout
# loop killer: adds a string, unless it is already present and nees quarantine
:0 H
* ^X-Loop:.*RANDOMSTRING
$SCRATCHDIR/Loops
:0 f
|formail -A "X-Loop: RANDOMSTRING"
:0 cH
* SOMEHEADERCOMPONENT
$SCRATCHDIR/attachments
:0 H
* ^From:.*(ONE|TWO).com
!myotherself@EXAMPLE.COM
# send big joke mails from a productive friend somewhere else
:0 H
* ^From:.*my\.funny\.friend@.*DOMAINCOMPONENT
* >15000
! mythirdself@EXAMPLE.COM
# a big newsletter
:0 H
* ^Subject:.*news.*letter
* >50000
! mythirdself@EXAMPLE.COM
# force fetchmail via incoming e-mail
:0 H:
* ^Subject:.*TRIGGERWORD
| ( cat >/dev/null ; echo 'Subject: fetchmail forced' ; echo ; fetchmail -t 100 2>&1 ) | $SENDMAIL $SENDMAILFLAGS $yargoext
# script processing, send a copy to external address for monitoring
:0 cH
* ^TOyargo\+keyword@
| $HOME/binaries/script.sh
:0 A
! $yargoext
# for saving some mail directly, as archiving method
:0 H:
* yargo\+otherkeyword
$SCRATCHDIR/attachments
# play by e-mail
:0 cH
* ^From:.*gamerz.net
! $yargoext
:0 A
$MAILDIR/gamerz.net
# myotherdomain.ch has its separate procmailrc
:0 H
* @myotherdomain.ch
{
 INCLUDERC=$HOME/.procmailrc-other
}
# a newsletter that I currently ignore but dont want to unsubscribe
# mailhtmldump.sh converts HTML e-mails into plaintext for reading on mobile
:0 H
* yargo\+KEYWORD
#|$HOME/binaries/mailhtmldump.sh Spiegel-Online $yargoext
/dev/null
# forwarding from .fetchmailrc
:0 cEH
* yargo\+FETCHMAIL@
$MAILDIR/FETCHMAIL
# whitelisting spamfilter
FROM=`formail -c -x 'From:'|sed -e 's/.*<\(.*@[^>]*\)>.*/\1/;s/^ *//;s/ *$//'`
:0 hb:
* ! ? grep -i -F -e "$FROM" $WHITELIST >/dev/null
$SCRATCHDIR/SPAM