PATH=/bin:/usr/bin:/usr/bin # use maildir for mail MAILDIR=$HOME/mail # where to put the log file LOGFILE=$HOME/.procmaillog # get the subject discarding any leading and trailing blanks # note: On some systems -xSubject: has to be -x"Subject: " SUBJ_=`formail -xSubject: | expand | sed -e 's/^[ ]*//g' -e 's/[ ]*$//g'` # get the hostname from the message id HOST_=`formail -xMessage-Id: | sed -e 's/\( <.*@\)//' -e 's/>//'` # the condition line ensures that only messages smaller than 250 kB # (250 * 1024 = 256000 bytes) are processed by SpamAssassin. Most spam # isn't bigger than a few k and working with big messages can bring # SpamAssassin to its knees. # the lock file ensures that only 1 spamassassin invocation happens # at 1 time, to keep the load down. :0fw: spamassassin.lock * < 256000 # we want to use the spamd not spamassassin directly # see the system wide configuration for spamassassin #| spamassassin | /usr/bin/spamc -f # not sure about this one #:0e #EXITCODE==$? # put mail tagged spam in spam dir :0: * ^X-Spam-Status: Yes $MAILDIR/spam/ # put Sobig virus mail in spam :0 B: * ^(Please s|S)ee the attached file for details\.?$ $MAILDIR/spam/ # put every mail including .pif, .exe or .scr attachments in spam :0 B * ^ *Content-Disposition: attachment; * filename=".*\.(pif|exe|scr)" $MAILDIR/spam/ # these are common anti virus warnings (ie more spam) # by courtesy of someone at debian-user # put these in spam folder :0: * ^Subject: (Undeliverable Message|Latest Network Critical Patch|Current Net Critical Pack|Latest Network Critical Pack|Abort Report|A virus has been detected in a document you authored.|RAV Antivirus:|BitDefender found an infected object|Virus Detected by Network Associates, Inc. Webshield|\x{2014}\x{2014} Virus Detected \x{2014}\x{2014}|Virus detected|Virus Alert|InterScan NT Alert|Virus found in the message|Message quarantined|VIRUS ALERT!|MDaemon Warning - Virus Found|Warning: E-mail viruses detected|ScanMail Message: To Sender virus found|VIRUS IN YOUR MAIL|Norton AntiVirus detected|VIRUS .* IN YOUR MAIL|Antigen found VIRUS|Filter incident|Vírus figyelmeztetés! Virus warning!|Symantec AVF detected|Returned due to virus;|Anti-Virus Notification|BANNED FILENAME|File blocked - ScanMail for Lotus|NAV detected a virus|RAV AntiVirus scan|VIRUS .+ IN MAIL FROM YOU|Virus Notification:|Virus found in a message you sent|Virus found in sent message|VIRUS EN SU CORREO|Warning: antivirus system report|M..Daemon Notification \x{2014} Attachment Removed|Information - Antivirus|Symantec AntiVirus detected a violation|WARNING: YOU WERE SENT A VIRUS|SAV detected a violation in a document|MailMarshal has detected a suspect attachment|A virus was detected in your mail|Recipient Virus-alert|Virus Found in message|E-?mail viruses detected|Undelivered mail: VIRUS FOUND|Quarantined Mail: virus from|Failed to clean virus|X-BLTSYMAVREINSERT|X-Virus-Scan-Result: Repaired|X-AtHome-MailScanner: Found to be infected|X-Scanned: Symantec Antivirus Scan - Virus found|X-Sender: NetMail AntiVirus Agent|X-yoursite-MailScanner: Found to be infected|Virusveszely! Virus warning!|Virus in mail from you.|Virus infection notice|Possible virus found in mess..age you sent|AntiVir ALERT|Centrale Anti-Virus melding|Vexira ALERT|X-ELTE-VirusStatus: was_infected|You sent potentially unsafe content|ID.*thanks ScanMail has detected a virus!|\{Virus\?\}) $MAILDIR/spam/ # my mailing lists :0: * ^From.*owner $MAILDIR/inbox/ :0: * ^TO.*debian-security-announce $MAILDIR/inbox/ :0: * ^TO.*debian-news $MAILDIR/inbox/ # automatically sort mailing lists based on these rules: # by courtesy of http://linuxbrit.co.uk/ :0: * ^X-Mailing-List:[ ]<\/[^ >`']+ lists/`echo $MATCH | sed -e 's/[\/]/_/g' | tr A-Z a-z`/ :0: * ^X-Mailing-List:[ ]\/[^ `']+ lists/`echo $MATCH | sed -e 's/[\/]/_/g' | tr A-Z a-z`/ :0: * ^Sender:[ ]owner-\/[^ `']+ lists/`echo $MATCH | sed -e 's/[\/]/_/g' | tr A-Z a-z`/ :0: * ^X-BeenThere:[ ]\/[^ `']+ lists/`echo $MATCH | sed -e 's/[\/]/_/g' | tr A-Z a-z`/ :0: * ^Delivered-To:[ ]mailing list \/[^ `']+ lists/`echo $MATCH | sed -e 's/[\/]/_/g' | tr A-Z a-z`/ :0: * ^X-Loop:[ ]\/[^ `']+ lists/`echo $MATCH | sed -e 's/[\/]/_/g' | tr A-Z a-z`/ # mail sent to root # put the hostname in the subject header # courtesy of http://www.uwasa.fi/~ts/info/proctips.html :0 * ^TO.*root { :0 fwh | formail -I"Subject: [${HOST_}] ${SUBJ_}" :0 $MAILDIR/root/ } # all other mail goes to Inbox :0: $MAILDIR/inbox/