Created
July 18, 2013 17:14
-
-
Save rsayers/6031105 to your computer and use it in GitHub Desktop.
I have a vps that does nothing but handle mail for 1 account, I needed something to block spam, but running spamd was too heavy for my vps. I run this every minute. it simply finds every mail <2 minutes old and moves it if spam assassin claims it is spam. It's low tech, but also low requirements.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| INBOX="/path/to/Maildir/cur" | |
| SPAM="/path/to/Maildir/.spam/cur" | |
| cd $INBOX | |
| for i in `find ./ -type f -mmin -2` | |
| do | |
| echo "Testing $i" | |
| if (cat $i | spamassassin | grep 'X-Spam-Flag..YES') | |
| then echo "$i is spam" | |
| mv $i $SPAM | |
| fi | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment