]> git.madduck.net Git - etc/mailfilter.git/blob - procmail/pre-spam-cleanup

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

replace existing x-tickle-delivered header
[etc/mailfilter.git] / procmail / pre-spam-cleanup
1 #!/usr/bin/procmail
2
3 PMDIR=${PMDIR:-$HOME/.etc/mailfilter/procmail}
4
5 :0
6 * !PMVAR ?? .
7 {
8   # PMVAR is not defined, so we are being called as filter
9   # thus source the standard defines
10   INCLUDERC=$PMDIR/defines
11   # prevent feeding back to procmail and delete the leading From line
12   PROCMAIL='/bin/cat'
13   # and tell the fucking procmail piece-of-shit to continue to be a filter
14   DEFAULT='|$PROCMAIL'
15 }
16
17 # unpack SA report_safe mails
18 :0
19 * B ?? ^Content-Type: message/rfc822; x-spam-type=original$
20 {
21   LOG="cleanup:     unpacking SA MIME-wrapped spam mail$NL"
22   :0 fw
23   |$SPAMASSASSIN -d
24 }
25
26 # remove other unwanted headers from all messages
27 :0 fw
28 |$FORMAIL -IX-Virus -IX-UID -IX-OfflineIMAP- -IX-Status -IStatus -IX-Keywords -IX-Greylist \
29           -IX-Spam -IX-CRM114 -IX-Auto -IX-Trained-As -IX-EqDomain -IX-EqTo -IX-Justme
30
31 # now should be idempotent