#                         THE SPAMBOUNCER
#                            aka sb.rc
#                           Version 1.5
#                       Last Updated  2/23/03
#
#      Copyright (C) 1996-2002 by Catherine A. Hampton.  If
#      you abide by the Free Software Foundation's COPYING
#      principles with this document and software, you're home free,
#      but don't try to copyright it yourself or sell this
#      information.
#
#      Installation instructions can be retrieved at:
#              http://www.spambouncer.org/
#



##########################################################################

# BRAND THE EMAIL WITH THE SPAMBOUNCER HEADER VERSION
:0 f
| ${FORMAIL} -A"X-SpamBouncer: 1.5 (2/23/03)"


# CHECK FOR PROPER SETTING OF VARIABLES
#
# This script checks to see if the necessary variables are set, and if
# they are not, sets them to harmless defaults which will minimize the effects
# of the SpamBouncer program.  If you don't set your variables, the
# SpamBouncer won't do much. :/

:0
* DEFAULT ?? ^^^^
* FORMAIL ?? ^^^^
* SBDIR ?? ^^^^
| ${FORMAIL} -A"X-SBRule: Pass-Bad Config"

# Start of "else" wrapper if critical variables set
:0 E
{

# Check for and set system variables.  (These should be set already,
# but just in case...
:0
* HOST ?? ^^^^
{ HOST=`hostname` }

:0
* LOGNAME ?? ^^^^
{ LOGNAME=someuser }


# Set LINEBUF to high figure to accomodate large recipes.
OLDLINEBUF=${LINEBUF}
LINEBUF=32776


# Set other internal variables to their initial states.
ADMINTAG=no
BLOCKTAG=no
BLOCKTHIS=no
BOUNCETHIS=no
BULKTAG=no
SPAMTAG=no
VIRUSTAG=no

# Test for other important variables and set defaults if not set or
# not set properly.  The commented out lines at the top of each
# recipe work with Procmail 3.11 and above, but appear to break
# Procmail 3.10 and below, so I'm trying an older, less efficient,
# but hopefully more generally useful means of doing this....

# ADMINFOLDER=${ADMINFOLDER:-$DEFAULT}
:0
* ADMINFOLDER ?? ^^^^
{ ADMINFOLDER=${DEFAULT} }

# ALTFROM=${ALTFROM:-$LOGNAME@$HOST}
:0
* ALTFROM ?? ^^^^
{ ALTFROM=${LOGNAME}@${HOST} }

# ALWAYSBLOCK=${ALWAYSBLOCK:-NONE}
:0
* ALWAYSBLOCK ?? ^^^^
{ ALWAYSBLOCK=NONE }

# ARABIC=${ARABIC:-no}
:0
* ARABIC ?? ^^^^
{ ARABIC=no }

# BASE64BLOCK=${BASE64:-no}
:0
{ SETDEF=yes }

:0
* BASE64BLOCK ?? yes
{ SETDEF=no }

:0
* SETDEF ?? yes
{ BASE64BLOCK=no }

# BLOCKFOLDER=${BLOCKFOLDER:-$DEFAULT}
:0
* BLOCKFOLDER ?? ^^^^
{ BLOCKFOLDER=${DEFAULT} }

# BLOCKREPLY=${BLOCKREPLY:-SILENT}
:0
{ SETDEF=yes }

:0
* BLOCKREPLY ?? SILENT
{ SETDEF=no }

:0
* BLOCKREPLY ?? NOTIFY
{ SETDEF=no }

:0
* SETDEF ?? yes
{ BLOCKREPLY=SILENT }

# BULKFOLDER=${BULKFOLDER:-$DEFAULT}
:0
* BULKFOLDER ?? ^^^^
{ BULKFOLDER=${DEFAULT} }

# BYPASSWD=${BYPASSWD:-zeugma}
:0
* BYPASSWD ?? ^^^^
{ BYPASSWD=zeugma }

# CHINESE=${CHINESE:-no}
:0
* CHINESE ?? ^^^^
{ CHINESE=no }

# CYRILLIC=${CYRILLIC:-no}
:0
* CYRILLIC ?? ^^^^
{ CYRILLIC=no }

# DATE
:0
* DATE ?? ^^^^
{ DATE=date }

# DEBUG=${DEBUG:-no}
:0
{ SETDEF=yes }

:0
* DEBUG ?? yes
{ SETDEF=no }

:0
* SETDEF ?? yes
{ DEBUG=no }

# DOMAIN
:0
* DOMAIN ?? ^^^^
{ DOMAIN=`domainname` }

# DORKSLCHECK
:0
{ SETDEF=yes }

:0
* DORKSLCHECK ?? yes
{ SETDEF=no }

:0
* SETDEF ?? yes
{ DORKSLCHECK=no }

# DSBLCHECK
:0
{ SETDEF=yes }

:0
* DSBLCHECK ?? yes
{ SETDEF=no }

:0
* SETDEF ?? yes
{ DSBLCHECK=no }

# DSBLMULTICHECK
:0
{ SETDEF=yes }

:0
* DSBLMULTICHECK ?? yes
{ SETDEF=no }

:0
* SETDEF ?? yes
{ DSBLMULTICHECK=no }

# DULCHECK
:0
{ SETDEF=yes }

:0
* DULCHECK ?? yes
{ SETDEF=no }

:0
* SETDEF ?? yes
{ DULCHECK=no }

# ECHO
:0
* ECHO ?? ^^^^
{ ECHO=echo }

# EXECHECKING
:0
{ SETDEF=yes }

:0
* EXECHECKING ?? OFF
{ SETDEF=no }

:0
* EXECHECKING ?? NONE
{ SETDEF=no }

:0
* EXECHECKING ?? no
{ SETDEF=no }

:0
* SETDEF ?? yes
{ EXECHECKING=yes }

# EXEDOCCHECKING
:0
{ SETDEF=no }

:0
* EXEDOCCHECKING ?? yes
{ SETDEF=yes }

:0
* SETDEF ?? no
{ EXEDOCCHECKING=no }

# FILTER=${FILTER:-no}
:0
* FILTER ?? ^^^^
{ FILTER=no }

# FREEMAIL
:0
* FREEMAIL ?? ^^^^
{ FREEMAIL=INTERNAL }

# FREEWEB
:0
* FREEWEB ?? ^^^^
{ FREEWEB=no }

# FTSGDIALCHECK
:0
{ SETDEF=yes }

:0
* FTSGDIALCHECK ?? yes
{ SETDEF=no }

:0
* SETDEF ?? yes
{ FTSGDIALCHECK=no }

# FTSGIGNORECHECK
:0
{ SETDEF=yes }

:0
* FTSGIGNORECHECK ?? yes
{ SETDEF=no }

:0
* SETDEF ?? yes
{ FTSGIGNORECHECK=no }

# FTSGMULTICHECK
:0
{ SETDEF=yes }

:0
* FTSGMULTICHECK ?? yes
{ SETDEF=no }

:0
* SETDEF ?? yes
{ FTSGMULTICHECK=no }

# FTSGOPTOUTCHECK
:0
{ SETDEF=yes }

:0
* FTSGOPTOUTCHECK ?? yes
{ SETDEF=no }

:0
* SETDEF ?? yes
{ FTSGOPTOUTCHECK=no }

# FTSGOTHERCHECK
:0
{ SETDEF=yes }

:0
* FTSGOTHERCHECK ?? yes
{ SETDEF=no }

:0
* SETDEF ?? yes
{ FTSGOTHERCHECK=no }

# FTSGRSSCHECK
:0
{ SETDEF=yes }

:0
* FTSGRSSCHECK ?? yes
{ SETDEF=no }

:0
* SETDEF ?? yes
{ FTSGRSSCHECK=no }

# FTSGSRCCHECK
:0
{ SETDEF=yes }

:0
* FTSGSRCCHECK ?? yes
{ SETDEF=no }

:0
* SETDEF ?? yes
{ FTSGSRCCHECK=no }

# FTSGWEBFORMCHECK
:0
{ SETDEF=yes }

:0
* FTSGWEBFORMCHECK ?? yes
{ SETDEF=no }

:0
* SETDEF ?? yes
{ FTSGWEBFORMCHECK=no }

# FREEMAIL=${FREEMAIL:-DEFAULT}
:0
* FREEMAIL ?? ^^^^
{ FREEMAIL=NONE }

# GARBLEDCHARSET=${GARBLEDCHARSET:-yes}
:0
* GARBLEDCHARSET ?? ^^^^
{ GARBLEDCHARSET=yes }

# GLOBALNOBOUNCE=${GLOBALNOBOUNCE:-NONE}
:0
* GLOBALNOBOUNCE ?? ^^^^
{ GLOBALNOBOUNCE=NONE }

# GREEK=${GREEK:-no}
:0
* GREEK ?? ^^^^
{ GREEK=no }

# GREP
:0
* GREP ?? ^^^^
{ GREP=fgrep }

# HABEASINFRINGERS
:0
{ SETDEF=no }

:0
* HABEASINFRINGERS ?? yes
{ SETDEF=yes }

:0
* SETDEF ?? no
{ HABEASINFRINGERS=no }

# HABEASUNVERIFIED
:0
{ SETDEF=no }

:0
* HABEASUNVERIFIED ?? yes
{ SETDEF=yes }

:0
* SETDEF ?? no
{ HABEASUNVERIFIED=no }

# HABEASVERIFIED
:0
{ SETDEF=no }

:0
* HABEASVERIFIED ?? yes
{ SETDEF=yes }

:0
* SETDEF ?? no
{ HABEASVERIFIED=no }

# HEBREW=${HEBREW:-no}
:0
* HEBREW ?? ^^^^
{ HEBREW=no }

# HTMLBLOCK
:0
{ SETDEF=no }

:0
* HTMLBLOCK ?? yes
{ SETDEF=yes }

:0
* SETDEF ?? no
{ HTMLBLOCK=no }

# JAPANESE=${JAPANESE:-no}
:0
* JAPANESE ?? ^^^^
{ JAPANESE=no }

# KOREAN=${KOREAN:-no}
:0
* KOREAN ?? ^^^^
{ KOREAN=no }

# LANGFILTER=${LANGFILTER:-no}
:0
* LANGFILTER ?? ^^^^
{ LANGFILTER=yes }

# LEAN=${LEAN:-yes}
:0
* LEAN ?? ^^^^
{ LEAN=yes }

# LEGITLISTS=${LEGITLISTS:-$HOME/.legitlists}
:0
* LEGITLISTS ?? ^^^^
{ LEGITLISTS=${HOME}/.legitlists }

# LOCALHOSTFILE=${LOCALHOSTFILE:-$HOME/.localhostfile}
:0
* LOCALHOSTFILE ?? ^^^^
{ LOCALHOSTFILE=${HOME}/.localhostfile }

# MONKEYFORMMAILCHECK
:0
{ SETDEF=yes }

:0
* MONKEYFORMMAILCHECK ?? yes
{ SETDEF=no }

:0
* SETDEF ?? yes
{ MONKEYFORMMAILCHECK=no }

# MONKEYPROXYCHECK
:0
{ SETDEF=yes }

:0
* MONKEYPROXYCHECK ?? yes
{ SETDEF=no }

:0
* SETDEF ?? yes
{ MONKEYPROXYCHECK=no }

# MYEMAIL=${MYEMAIL:-$HOME/.myemail}
:0
* MYEMAIL ?? ^^^^
{ MYEMAIL=${HOME}/.myemail }

# NOBOUNCE=${NOBOUNCE:-$HOME/.nobounce}
:0
* NOBOUNCE ?? ^^^^
{ NOBOUNCE=${HOME}/.nobounce }

# NOLOOP=${NOLOOP:-$ALTFROM}
:0
* NOLOOP ?? ^^^^
{ NOLOOP=${ALTFROM} }

# NSLOOKUP
:0
* NSLOOKUP ?? ^^^^
{ NSLOOKUP="nslookup -timeout=5 -retry=2" }

# NUKEBOUNCES
:0
* NUKEBOUNCES ?? ^^^^
{ NUKEBOUNCES=no }

# ORDBCHECK
:0
{ SETDEF=yes }

:0
* ORDBCHECK ?? yes
{ SETDEF=no }

:0
* SETDEF ?? yes
{ ORDBCHECK=no }

# OSDIALCHECK
:0
{ SETDEF=yes }

:0
* OSDIALCHECK ?? no
{ SETDEF=no }

:0
* SETDEF ?? yes
{ OSDIALCHECK=yes }

# OSHAVENCHECK
:0
{ SETDEF=yes }

:0
* OSHAVENCHECK ?? yes
{ SETDEF=no }

:0
* SETDEF ?? yes
{ OSHAVENCHECK=no }

# OSOOLCHECK
:0
{ SETDEF=yes }

:0
* OSOOLCHECK ?? yes
{ SETDEF=no }

:0
* SETDEF ?? yes
{ OSOOLCHECK=no }

# OSOPSCHECK
:0
{ SETDEF=yes }

:0
* OSOPSCHECK ?? yes
{ SETDEF=no }

:0
* SETDEF ?? yes
{ OSOPSCHECK=no }

# OSORCHECK
:0
{ SETDEF=yes }

:0
* OSORCHECK ?? yes
{ SETDEF=no }

:0
* SETDEF ?? yes
{ OSORCHECK=no }

# OSSHRCHECK
:0
{ SETDEF=yes }

:0
* OSSHRCHECK ?? yes
{ SETDEF=no }

:0
* SETDEF ?? yes
{ OSSHRCHECK=no }

# OSSPAMCHECK
:0
{ SETDEF=yes }

:0
* OSSPAMCHECK ?? no
{ SETDEF=no }

:0
* SETDEF ?? yes
{ OSSPAMCHECK=yes }

# PATTERNMATCHING
:0
{ SETDEF=yes }

:0
* PATTERNMATCHING ?? SILENT
{ SETDEF=no }

:0
* PATTERNMATCHING ?? NOTIFY
{ SETDEF=no }

:0
* SETDEF ?? yes
{ PATTERNMATCHING=NONE }

# RBLCHECK
:0
{ SETDEF=yes }

:0
* RBLCHECK ?? yes
{ SETDEF=no }

:0
* SETDEF ?? yes
{ RBLCHECK=no }

# RFCABUSECHECK
:0
{ SETDEF=yes }

:0
* RFCABUSECHECK ?? yes
{ SETDEF=no }

:0
* SETDEF ?? yes
{ RFCABUSECHECK=no }

# RFCDSNCHECK
:0
{ SETDEF=yes }

:0
* RFCDSNCHECK ?? yes
{ SETDEF=no }

:0
* SETDEF ?? yes
{ RFCDSNCHECK=no }

# RFCIPWHOISCHECK
:0
{ SETDEF=yes }

:0
* RFCIPWHOISCHECK ?? yes
{ SETDEF=no }

:0
* SETDEF ?? yes
{ RFCIPWHOISCHECK=no }

# RFCPOSTMASTERCHECK
:0
{ SETDEF=yes }

:0
* RFCPOSTMASTERCHECK ?? yes
{ SETDEF=no }

:0
* SETDEF ?? yes
{ RFCPOSTMASTERCHECK=no }

# RFCWHOISCHECK
:0
{ SETDEF=yes }

:0
* RFCWHOISCHECK ?? yes
{ SETDEF=no }

:0
* SETDEF ?? yes
{ RFCWHOISCHECK=no }

# RM
:0
* RM ?? ^^^^
{ RM=rm }

# RSLCHECK
:0
{ SETDEF=yes }

:0
* RSLCHECK ?? yes
{ SETDEF=no }

:0
* SETDEF ?? yes
{ RSLCHECK=no }

# RSSCHECK
:0
{ SETDEF=yes }

:0
* RSSCHECK ?? yes
{ SETDEF=no }

:0
* SETDEF ?? yes
{ RSSCHECK=no }

# RUSSIAN=${RUSSIAN:-no}
:0
* RUSSIAN ?? ^^^^
{ RUSSIAN=no }

# SBDEBUG=${SBDEBUG:-no}
:0
{ SETDEF=yes }

:0
* SBDEBUG ?? yes
{ SETDEF=no }

:0
* SETDEF ?? yes
{ SBDEBUG=no }

# SBDEFANG
:0
* SBDEFANG ?? ^^^^
{ SBDEFANG=no }


# SBTEMP
:0
* SBTEMP ?? ^^^^
{ SBTEMP=/tmp }

# SBTRAP
# The SBTRAP variable may be set here so it has a system-wide effect,
# provided spambouncer has been installed in a system-wide shared directory,
# overriding possible user settings or absence of setting for this variable.

# The spamtrap variable, when set to a valid e-mail address, causes every
# message classified as "Spam" or "Virus" to be forwarded to the specified
# administrative account for examination.
:0
* SBTRAP ?? ^^^^
{ SBTRAP=NONE }

# SED
:0
* SED ?? ^^^^
{ SED=sed }

# SENDMAIL=${SENDMAIL:-/usr/sbin/sendmail}
:0
* SENDMAIL ?? ^^^^
{ SENDMAIL=/usr/sbin/sendmail }

# SPAMCOPCHECK
:0
{ SETDEF=yes }

:0
* SPAMCOPCHECK ?? yes
{ SETDEF=no }

:0
* SETDEF ?? yes
{ SPAMCOPCHECK=no }

# SPAMFOLDER=${SPAMFOLDER:-$DEFAULT}
:0
* SPAMFOLDER ?? ^^^^
{ SPAMFOLDER=${DEFAULT} }

# SPAMHAUSORGCHECK
:0
{ SETDEF=yes }

:0
* SPAMHAUSORGCHECK ?? no
{ SETDEF=no }

:0
* SETDEF ?? yes
{ SPAMHAUSORGCHECK=yes }

# SPAMREPLY=${SPAMREPLY:-SILENT}
:0
{ SETDEF=yes }

:0
* SPAMREPLY ?? BOUNCE
{ SETDEF=no }

:0
* SPAMREPLY ?? COMPLAIN
{ SETDEF=no }

:0
* SPAMREPLY ?? BOTH
{ SETDEF=no }

:0
* SETDEF ?? yes
{ SPAMREPLY=SILENT }

# SPEWSCHECK
:0
{ SETDEF=yes }

:0
* SPEWSCHECK ?? yes
{ SETDEF=no }

:0
* SETDEF ?? yes
{ SPEWSCHECK=no }

# TEST
:0
* TEST ?? ^^^^
{ TEST=test }

# THISISP=${THISISP:-$DOMAIN}
:0
* THISISP ?? ^^^^
{ THISISP=${DOMAIN} }

# TURKISH=${TURKISH:-no}
:0
* TURKISH ?? ^^^^
{ TURKISH=no }

# VIRUSCHECKING
:0
{ SETDEF=yes }

:0
* VIRUSCHECKING ?? OFF
{ SETDEF=no }

:0
* VIRUSCHECKING ?? NONE
{ SETDEF=no }

:0
* VIRUSCHECKING ?? NO
{ SETDEF=no }

:0
* SETDEF ?? yes
{ VIRUSCHECKING=YES }

# VIRUSFOLDER=${VIRUSFOLDER:-$DEFAULT}
:0
* VIRUSFOLDER ?? ^^^^
{ VIRUSFOLDER=${SPAMFOLDER} }

# WIREHUBDIALUP
:0
{ SETDEF=yes }

:0
* WIREHUBDIALUP ?? yes
{ SETDEF=no }

:0
* SETDEF ?? yes
{ WIREHUBDIALUP=no }

# WIREHUBSPAMSOURCE
:0
{ SETDEF=yes }

:0
* WIREHUBSPAMSOURCE ?? yes
{ SETDEF=no }

:0
* SETDEF ?? yes
{ WIREHUBSPAMSOURCE=no }


# GET HEADER INFORMATION

INCLUDERC=${SBDIR}/sb-getheaderinfo.rc


# TEST PROGRAM REVISION DATE
#
#    This resets SPAMREPLY, BLOCKREPLY and PATTERNMATCHING all to SILENT if
#    this copy of the SpamBouncer program is more than a month old.
#
#    This was added to minimize problems caused when users don't update
#    frequently enough, and run in BOUNCE or COMPLAIN mode.  Since spammers move around
#    a lot, out-of-date copies of the SpamBouncer have sometimes resulted
#    in flooding former ISPs of spammers with complaints about spam sent
#    through new connections. :/
#
#    After the program is a month old, there is a significant chance that any
#    autoresponse may be in error, so I have set it to revert to SILENT mode
#    after that time.
#
#    Please note that, if you have PATTERNMATCHING set to none, that will
#    remain the setting.
#
#

:0
{ CM=`date +%y%m` }

:0
{ RESPOND=no }

:0
* CM ?? 0303
{ RESPOND=yes }

:0
* CM ?? 0302
{ RESPOND=yes }

:0
* RESPOND ?? no
{
 :0
 { SPAMREPLY=SILENT }
}


# BOUNCES TO SPAMBOUNCER SPAM COMPLAINTS, BOUNCES, OR BLOCK NOTIFICATIONS
#
# Nuke bounces to the SpamBouncer's own spam complaints, bounces, or block
# notifications.

:0 BH
* ^From:.*(Internet Mail Delivery|Mail Delivery Subsystem|MAILER-DAEMON|postman-service@)
* ^From:(.*$)+^$(.*$)+^From:[ ]+(${ALTFROM}|MAILER-DAEMON)
* ^From:(.*$)+^$(.*$)+X-Loop: (${NOLOOP}|MAILER-DAEMON)
* ^From:(.*$)+^$(.*$)+^X-SpamBouncer:
{
 :0 f
 | ${FORMAIL} -A"X-SBPass: Bounced SpamBouncer Admin Message"

 :0
 * NUKEBOUNCES ?? yes
 /dev/null

 :0
 { ADMINTAG=yes }

 :0
 { BOUNCESANDSTUFF=yes }
}


# Filter out known sources of bounce messages and adminstrative junk
:0
* ^From:.*(NAV for Microsoft Exchange|\
           tickets@above\.net([^a-z0-9\.]|$)|\
           autopost@general\.amug\.org([^a-z0-9\.]|$)|\
           abuse@aol\.net([^a-z0-9\.]|$)|\
           support@arcor\.net([^a-z0-9\.]|$)|\
           please_do_not_reply@att\.net([^a-z0-9\.]|$)|\
           Abuse@attbi.com|\
           ops@bbnplanet\.com([^a-z0-9\.]|$)|\
           abuse(-bounce)?@.*bellsouth\.net([^a-z0-9\.]|$)|\
           abuse@best\.(com|net)([^a-z0-9\.]|$)|\
           info@.*biglobe\.ne\.jp([^a-z0-9\.]|$)|\
           nobody@.*cadvision\.com([^a-z0-9\.]|$)|\
           mailadmin@care2\.com([^a-z0-9\.]|$)|\
           abuse@cerf\.net([^a-z0-9\.]|$)|\
           Charm\.Net's\.Abuse\.Center@charm.net([^a-z0-9\.]|$)|\
           abuse@chinanetcenter\.com([^a-z0-9\.]|$)|\
           abuse-bounce@.*cjb\.net([^a-z0-9\.]|$)|\
           abuse@compuserve\.com([^a-z0-9\.]|$)|\
           abuse@concentric\.net([^a-z0-9\.]|$)|\
           abuse@concert\.net([^a-z0-9\.]|$)|\
           nobody@connect\.com\.au([^a-z0-9\.]|$)|\
           abuse@cp\.net([^a-z0-9\.]|$)|\
           abuse@cw\.net([^a-z0-9\.]|$)|\
           Postmaster@.*cwplc\.com([^a-z0-9\.]|$)|\
           abuse@tipa2\.cwix\.net([^a-z0-9\.]|$)|\
           spamcomplaints@cw[-_a-z0-9]*\.com([^a-z0-9\.]|$)|\
           spamcomplnts@.*cw\.net([^a-z0-9\.]|$)|\
           spamcomplaints@cwbusiness\.com([^a-z0-9\.]|$)|\
           abuse-reply@direct-connect.com([^a-z0-9\.]|$)|\
           policy@.*digex\.net([^a-z0-9\.]|$)|\
           spam@mercury\.earthlink\.net([^a-z0-9\.]|$)|\
           abuse@easy\.to([^a-z0-9\.]|$)|\
           safeharbor@ebay\.com([^a-z0-9\.]|$)|\
           abuse-resp@eli\.net([^a-z0-9\.]|$)|\
           abuse@energis-squared\.com([^a-z0-9\.]|$)|\
           listserv@.*espire.net([^a-z0-9\.]|$)|\
           abuse@exodus\.net([^a-z0-9\.]|$)|\
           abuse@genuity\.com([^a-z0-9\.]|$)|\
           abuse@geocities\.com([^a-z0-9\.]|$)|\
           abuse@.*home\.net([^a-z0-9\.]|$)|\
           abuse@host4u\.net([^a-z0-9\.]|$)|\
           abuse\.autoresponder@host4u\.net([^a-z0-9\.]|$)|\
           (abuse|policy)@hotmail\.com([^a-z0-9\.]|$)|\
           postmaster@mail\.hotmail\.com([^a-z0-9\.]|$)|\
           help@idirect\.com([^a-z0-9\.]|$)|\
           webmaster@imagelinkusa\.net([^a-z0-9\.]|$)|\
           NOC-[0-9a-z]*@inflow\.com([^a-z0-9\.]|$)|\
           abuse@.*interland\.net([^a-z0-9\.]|$)|\
           wfeyereisen@Interelate\.com([^a-z0-9\.]|$)|\
           postmaster@juno\.com([^a-z0-9\.]|$)|\
           spamtool.*@.*level3\.(com|net)([^a-z0-9\.]|$)|\
           SPAMCOMPLNTS@.*MCI.NET([^a-z0-9\.]|$)|\
           postmast2000@mass?-pop\.pmm\.mci\.net([^a-z0-9\.]|$)|\
           abuse@mindspring\.net([^a-z0-9\.]|$)|\
           abuse@microsoft\.com([^a-z0-9\.]|$)|\
           abuse@mo\.com([^a-z0-9\.]|$)|\
           (abuse|postmaster)@.*msn\.com([^a-z0-9\.]|$)|\
           cyberfraud@nasaa\.org([^a-z0-9\.]|$)|\
           abuse@.*neosoft\.com([^a-z0-9\.]|$)|\
           abuse@netcom\.com([^a-z0-9\.]|$)|\
           abuse@ntlworld\.com([^a-z0-9\.]|$)|\
           abuse@paetec\.com([^a-z0-9\.]|$)|\
           abusenet@paetec\.com([^a-z0-9\.]|$)|\
           abuse@passport\.ca([^a-z0-9\.]|$)|\
           policy@pbi\.net([^a-z0-9\.]|$)|\
           autoreply@psi\.com([^a-z0-9\.]|$)|\
           abuse@prodigy\.(com|net)([^a-z0-9\.]|$)|\
           abuse@rackspace\.com([^a-z0-9\.]|$)|\
           forgotpass@rediff\.co\.in([^a-z0-9\.]|$)|\
           abuse@rr\.com([^a-z0-9\.]|$)|\
           abuse@saix\.net([^a-z0-9\.]|$)|\
           Savvis-AbuseCoordinatorArchive@.*Savvis\.net([^a-z0-9\.]|$)|\
           abuse@seabone\.net([^a-z0-9\.]|$)|\
           enforcement@sec\.gov([^a-z0-9\.]|$)|\
           internet\.abuse@shaw\.ca([^a-z0-9\.]|$)|\
           nobody@spamcop\.net([^a-z0-9\.]|$)|\
           abuse@sprint(link)?\.net([^a-z0-9\.]|$)|\
           abuse@swbell\.net([^a-z0-9\.]|$)|\
           raptor@nampo\.tci\.com([^a-z0-9\.]|$)|\
           abuse@telia\.com([^a-z0-9\.]|$)|\
           Abuse\.Response@telstra\.net([^a-z0-9\.]|$)|\
           abuse@topica\.com([^a-z0-9\.]|$)|\
           abuse@.*tripod\.com([^a-z0-9\.]|$)|\
           sysop@uswest.net([^a-z0-9\.]|$)|\
           nobody@.*uu.net([^a-z0-9\.]|$)|\
           abuse@gonk\.valueweb\.net([^a-z0-9\.]|$)|\
           abuse@.*verio\.net([^a-z0-9\.]|$)|\
           abuse@verizon\.net([^a-z0-9\.]|$)|\
           no-replies-please@wcom\.com([^a-z0-9\.]|$)|\
           autoresponder@.*webtv\.net([^a-z0-9\.]|$)|\
           spambuster@.*whowhere\.com([^a-z0-9\.]|$)|\
           abuse@.*xo\.com([^a-z0-9\.]|$)|\
           mail-abuse@yahoo-inc\.com([^a-z0-9\.]|$))
{
 :0 f
 | ${FORMAIL} -A"X-SBPass: Autobot/Abuse"

 :0
 * NUKEBOUNCES ?? yes
 /dev/null

 :0
 { ADMINTAG=yes }

 :0
 { BOUNCESANDSTUFF=yes }
}

:0
* BOUNCESANDSTUFF ?? yes
{ BOUNCESANDSTUFF=yes }


# Start of "else" wrapper so BOUNCESANDSTUFF matches skip everything else and are taken care of
:0 E
{

# EMAIL VIRUS FILTERS
#
# Filters to catch common email viruses, many of them set up to spam themselves
# without the sender's knowledge.  Since you are considerably =MORE= likely
# to get these viruses from people you normally correspond with than from
# strangers, this recipe alone is put outside of the NOBOUNCE filters, and
# is run on all email the SpamBouncer processes.
#
# The SpamBouncer's internal virus checking can be turned off, however, by
# setting VIRUSCHECKING=no in your .procmailrc file.  You may want to do this
# if you use another, presumably more powerful, antivirus program on your
# mail server and don't want to waste CPU cycles.

:0
* VIRUSCHECKING ?? yes
{
 INCLUDERC=${SBDIR}/sb-viruses.rc
}

INCLUDERC=${SBDIR}/sb-dangerous.rc

:0
* VIRUSTAG ?? yes
{ VIRUSTAG=yes }


# Start of "else" wrapper so virus matches skip everything else and are taken care of
:0 E
{

:0
* > 1024000
{
:0 f
| ${FORMAIL} -A"X-SBPass: Oversize"

:0
{ BULKTAG=yes }
}


# Start of "else" wrapper for email that is not over 1 MB in size
:0 E
{

# THE NOBOUNCE FILE

#    This is a file of addresses of friends and others you
#    want to get mail from, but who are at spam haven
#    domains/systems.  This way, they can mail you without
#    trouble, even if your filter drops all other mail from
#    that site.

:0 f
* ? ${TEST} -f ${NOBOUNCE} && (${FORMAIL} -zxFrom: -zxReply-To: | ${GREP} -i -f ${NOBOUNCE})
| ${FORMAIL} -A"X-SBPass: NoBounce"

# Start of "else" wrapper so NoBounce matches skip everything else
:0 E
{

# GLOBALNOBOUNCE system nobounce file processing

#    This is identical to the other NOBOUNCE file, except that a
#    system administrator maintains it for all users on the
#    system.

:0 f
* ! GLOBALNOBOUNCE ?? NONE
* ? ${TEST} -f ${GLOBALNOBOUNCE} && (${FORMAIL} -zxFrom: -zxReply-To: | ${GREP} -i -f ${GLOBALNOBOUNCE})
| ${FORMAIL} -A"X-SBPass: GlobalNoBounce"

# Start of "else" wrapper so GlobalNoBounce matches skip everything else
:0 E
{

# ALWAYSBLOCK private block list file processing

#  This is the opposite of your NOBOUNCE file -- email from any
#  email address or domain that appears in this file will always
#  be put in your BLOCKFOLDER.  Since these senders are presumably
#  known spammers or people you don't want to interact with, however,
#  no notices are sent for this blocked email.
#
#  Email blocked by this file is not processed further by the
#  SpamBouncer, as well.  No other filtering is done on it.
#
#  This is a DANGEROUS capability, and I am offering it with some
#  hesitation.  Please be careful -- if you put a partial string
#  or domain in this file, you could block a lot of legitimate
#  email.

:0
* !ALWAYSBLOCK ?? NONE
{
 :0
 * ? ${TEST} -f ${ALWAYSBLOCK} && (${FORMAIL} -zxFrom: -zxReply-To: | ${GREP} -i -f ${ALWAYSBLOCK})
 {
  :0 f
  | ${FORMAIL} -A"X-SBRule: AlwaysBlock File"

  :0
  { BLOCKTAG=yes }

  :0
  { ALWAYSBLOCKTAG=yes }
 }
}

:0
* ALWAYSBLOCKTAG ?? yes
{ BLOCKREPLY=SILENT }

# Start of "else" wrapper so ALWAYSBLOCK matches skip everything else
:0 E
{


# Filter out known opt-in mailing lists (External List)
:0
* ? ${TEST} -f ${LEGITLISTS} && (${FORMAIL} \
                                -zxCc: \
                                -zxFrom: \
                                -zxResent-By: \
                                -zxResent-From: \
                                -zxResent-Sender: \
                                -zxResent-To: \
                                -zxReply-To: \
                                -zxSender: \
                                -zxTo: \
    | ${GREP} -i -f ${LEGITLISTS})
{
:0 f
| ${FORMAIL} -A"X-SBPass: Legitimate Mailing List (External)"

:0
{ BULKTAG=yes }
}

# Start of "else" wrapper so Legitimate Mailing List (External) matches skip everything else
:0 E
{

# WHITELISTS
#
#  This section contains the whitelists the SpamBouncer supports.  Whitelisted
#  email is not filtered further.
#

INCLUDERC=${SBDIR}/sb-whitelists.rc

:0
* WHITELIST ?? yes
{ WHITELIST=yes }


# Start of "else" wrapper so that WHITELIST matches skip everything else
:0 E
{


# Make sure you aren't autoreplying to a mailer daemon
:0
*  ^From (MAILER-DAEMON([ ]|@)|Mail Delivery Subsystem|<>)
*  ^From:.*((^|[^-_0-9a-z])MAILER-DAEMON([ ]|@)|Mail Delivery Subsystem)
* !^Received:.*usaleonline\.com([^a-z0-9\.]|$)
{
 :0 f
 | ${FORMAIL} -A"X-SBPass: MAILER-DAEMON"

 :0
 { ADMINTAG=yes }
}


# Start of "else" wrapper so MAILER-DAEMON matches skip everything else
:0 E
{

# CHECK FOR BYPASSWD
:0 f
* $ ^Subject:.*${BYPASSWD}
| ${FORMAIL} -A"X-SBPass: BYPASSWD"


# Start of "else" wrapper so BYPASSWD matches skip everything else
:0 E
{

# Stick NOLOOP stuff into ADMIN
:0
* $ ^X-Loop: ${NOLOOP}
{
 :0 f
 | ${FORMAIL} -A"X-SBPass: NOLOOP"

 :0
 { ADMINTAG=yes }
}


# Start of "else" wrapper so NOLOOP matches skip everything else
:0 E
{


# Identify Admin email
:0
* (^FROM_MAILER([^a-z0-9\.]|$)|\
   ^(From|Sender).*[^0-9a-z]abuse.*@|\
   ^(From|Sender).*[^0-9a-z]admin.*@|\
   ^(From|Sender).*[^0-9a-z]auto.*@|\
   ^(From|Sender).*[^0-9a-z]dummy@c-zone\.net|\
   ^(From|Sender).*[^0-9a-z]helpdesk@|\
   ^(From|Sender).*[^0-9a-z]hostmaster@|\
   ^(From|Sender).*info@|\
   ^(From|Sender).*[^0-9a-z]list@|\
   ^(From|Sender).*[^0-9a-z]listserv@|\
   ^(From|Sender).*[^0-9a-z]macjordomo?@|\
   ^(From|Sender).*[^0-9a-z].*mail(er|man)?@|\
   ^(From|Sender).*[^0-9a-z].*mailadmin@|\
   ^(From|Sender).*[^0-9a-z]majordomo?@|\
   ^(From|Sender).*[^0-9a-z]nobody@|\
   ^(From|Sender).*[^0-9a-z]noc@|\
   ^(From|Sender).*[^0-9a-z]noreply@|\
   ^(From|Sender).*[^0-9a-z]policy@|\
   ^(From|Sender).*[^0-9a-z]spam@|\
   ^(From|Sender).*[^0-9a-z]support@|\
   ^(From|Sender).*[^0-9a-z].*postmaster)
*  !^From.*MAILER-DAEMON([ ]|@|$)
*  !^Resent-(By|From|To|Sender):
{
 :0 f
 | ${FORMAIL} -A"X-SBNote: From Admin"

 :0
 { ADMINTAG=yes }
}


# Tag bulk email that admits it is bulk :)
#
:0
* (^FROM_DAEMON|\
   ^Precedence: (Bulk|Junk|List)|\
   ^Resent-(By|From|To|Sender):|\
   ^List-[0-9a-z]*:|\
   ^X-ListName:|\
   ^X-Listprocessor|\
   ^X-Listserver:|\
   ^X-Lyris-(To|MemberID|MessageID):|\
   ^Received:.*majordom)
{
 :0 f
 | ${FORMAIL} -A"X-SBNote: FROM_DAEMON/Listserv"

 :0
 { BULKTAG=yes }
}


# Check for LARGE messages
:0
{ LEANTAG=no }

:0
* LEAN ?? yes
* > 100000
{
 :0 f
 | ${FORMAIL} -A"X-SBPass: Oversize-LeanTagged"

 :0
 { LEANTAG=yes }
}


# Set SPAMREPLY complaints properly
:0
{ SRC=no }

:0
* SPAMREPLY ?? COMPLAIN
{ SRC=yes }

:0
* SPAMREPLY ?? BOTH
{ SRC=yes }


# Set SPAMREPLY bounces properly
:0
{ SRB=no }

:0
* SPAMREPLY ?? BOUNCE
{ SRB=yes }

:0
* SPAMREPLY ?? BOTH
{ SRB=yes }




##########################################################################

# FRAUDULENT SCAMS/SPAMS
#
# Spams like the Nigerian 4-1-9 advance fee fraud that are sent to promote known
# illegal and often dangerous scams that are under investigation by
# Interpol, the FBI, or another national police force or forces.  Usually
# the SpamBouncer will not try to autocomplain about these spams, which
# normally are heavily forged to conceal their origin, but may report
# them to the appropriate police forces where possible.

:0
* SBDEBUG ?? yes
{
 INCLUDERC=${SBDIR}/sb-fraud.rc
}

:0 E
* VIRUSTAG ?? no
{
 INCLUDERC=${SBDIR}/sb-fraud.rc
}


# ROGUE SPAM SITES
#
#  Sites that exist to spam.

:0
* SBDEBUG ?? yes
{
 INCLUDERC=${SBDIR}/sb-rogue.rc
}

:0 E
* VIRUSTAG ?? no
{
 INCLUDERC=${SBDIR}/sb-rogue.rc
}


# SPAM-FOR-HIRE SITES
#
# Companies that provide bulk email services for other companies, and who
# do not exercise due diligence to ensure that their bulk email is sent
# only to people who have asked to receive it.  Many of the companies in
# this category spam for companies in the MainSleaze category.

:0
* SBDEBUG ?? yes
{
 INCLUDERC=${SBDIR}/sb-spamforhire.rc
}

:0 E
* VIRUSTAG ?? no
{
 INCLUDERC=${SBDIR}/sb-spamforhire.rc
}


# PORN SPAMMERS
#
# Porn sites and nests that don't fit into the categories above.  I list these
# separately because there are so many of them. <sigh>

:0
* SBDEBUG ?? yes
{
 INCLUDERC=${SBDIR}/sb-porn.rc
}

:0 E
* VIRUSTAG ?? no
{
 INCLUDERC=${SBDIR}/sb-porn.rc
}


# ORDINARY SPAMMERS
#
#  Spammers that run businesses which might exist in real life or have
#  legitimate customers, but that's questionable.

:0
* SBDEBUG ?? yes
{
 INCLUDERC=${SBDIR}/sb-ordinary.rc
}

:0 E
* VIRUSTAG ?? no
{
 INCLUDERC=${SBDIR}/sb-ordinary.rc
}


# MAINSLEAZE SPAMMERS
#
#  Sites that belong to otherwise legitimate companies that spam, but
#  that you might have to do business with.

:0
* SBDEBUG ?? yes
{
 INCLUDERC=${SBDIR}/sb-mainsleaze.rc
}

:0 E
* VIRUSTAG ?? no
{
 INCLUDERC=${SBDIR}/sb-mainsleaze.rc
}


# SPAMMING ISPS
#
# Internet Service Providers all or most of whose known customers are spammers,
# and which either openly allow spamming or which have a long-documented record of
# not taking action against their customers when those customers spam.

:0
* SBDEBUG ?? yes
{
 INCLUDERC=${SBDIR}/sb-spamisps.rc
}

:0 E
* VIRUSTAG ?? no
{
 INCLUDERC=${SBDIR}/sb-spamisps.rc
}


# IDEOLOGICAL SPAMMERS
#
#  Spammers that spam primarily for political, religious, or other ideological
#  causes, where money is a secondary concern if it is a concern at all.

:0
* SBDEBUG ?? yes
{
 INCLUDERC=${SBDIR}/sb-ideological.rc
}

:0 E
* VIRUSTAG ?? no
{
 INCLUDERC=${SBDIR}/sb-ideological.rc
}


# THE NUISANCE FILE
#
#  Spam and spammers that are clearly distinguishable and prolific, but that
#  have no single internet presence.  Put here to be sure they stuff is
#  caught, but no autocomplaints are sent because there's no place to send
#  them.

:0
* SBDEBUG ?? yes
{
 INCLUDERC=${SBDIR}/sb-nuisance.rc
}

:0 E
* VIRUSTAG ?? no
{
 INCLUDERC=${SBDIR}/sb-nuisance.rc
}


# SMALL FRY
#
# Spam sites in this category are considered "small fry" not worth a
# full entry in the SpamBouncer (which quickly gets big enough to
# slow down delivery of mail), but are definitely spammers.  These
# recipes are run only if the email has not already been classified
# as a virus or spam.

:0
* SBDEBUG ?? yes
{
 INCLUDERC=${SBDIR}/sb-smallfry.rc
 INCLUDERC=${SBDIR}/sb-havendomains.rc
 INCLUDERC=${SBDIR}/sb-spamphone.rc
 INCLUDERC=${SBDIR}/sb-spampostal.rc
}

:0 E
* VIRUSTAG ?? no
* SPAMTAG ?? no
{
 INCLUDERC=${SBDIR}/sb-smallfry.rc
 INCLUDERC=${SBDIR}/sb-havendomains.rc
 INCLUDERC=${SBDIR}/sb-spamphone.rc
 INCLUDERC=${SBDIR}/sb-spampostal.rc
}

# SPAM MAILER SOFTWARE

:0
* SBDEBUG ?? yes
{
 INCLUDERC=${SBDIR}/sb-spamsw.rc
}

:0 E
* VIRUSTAG ?? no
* SPAMTAG ?? no
{
 INCLUDERC=${SBDIR}/sb-spamsw.rc
}

# GENERIC SPAM HEADERS

:0
* SBDEBUG ?? yes
{
 INCLUDERC=${SBDIR}/sb-spamheaders.rc
}

:0 E
* VIRUSTAG ?? no
* SPAMTAG ?? no
{
 INCLUDERC=${SBDIR}/sb-spamheaders.rc
}


##########################################################################

# PROBABLE SPAM

# The remaining recipes filter out mail with certain subjects
# and To: lines which almost always indicate a spam and which
# are difficult to catch otherwise.  Since there's no way to
# be absolutely certain this stuff is from a spammer, though, it
# is handled as blocked mail rather than spam.  DO NOT send this
# email to /dev/null unless you don't mind loosing valid email!

# Recipes in this section are run only if email is not already
# classified as a virus or spam.


# CHECK THE BLACKLISTS
# This recipe checks those blacklists you have configured the
# SpamBouncer to use, which may include one of the MAPS blacklists,
# one of the Osirusoft blacklists, one of the ORBS descendents,
# the SpamHaus.org blacklist, or others.

:0
* SBDEBUG ?? yes
{
 INCLUDERC=${SBDIR}/sb-blacklists.rc
}

:0 E
* VIRUSTAG ?? no
* SPAMTAG ?? no
{
 INCLUDERC=${SBDIR}/sb-blacklists.rc
}


# BLOCKED MAIL SOFTWARE
# Mass mailers which aren't always used for spamming, but usually are.

:0
* SBDEBUG ?? yes
{
 INCLUDERC=${SBDIR}/sb-blocksw.rc
}

:0 E
* VIRUSTAG ?? no
* SPAMTAG ?? no
{
 INCLUDERC=${SBDIR}/sb-blocksw.rc
}

# BLOCKED HEADERS
# Headers that usually indicate spam, but not always

:0
* SBDEBUG ?? yes
{
 INCLUDERC=${SBDIR}/sb-blockheaders.rc
}

:0 E
* VIRUSTAG ?? no
* SPAMTAG ?? no
{
 INCLUDERC=${SBDIR}/sb-blockheaders.rc
}

# LANGUAGE FILTERS
# Languages that you shouldn't receive
#
# These recipes filter out email sent in Chinese and other languages in which
# I frequently see spam and put it in your BLOCKFOLDER.  If you get email
# in one of these languages, you can set the one of the language variables
# to skip checking for that language.  For example, you can set CHINESE=yes
# if you get email in Chinese, or KOREAN=yes if you get email in Korean.
#
# Given the prevalence of spammers in China and certain other Asian countries
# right now, this extra filter is likely to catch a lot of spam which normal
# pattern matching filters written by someone who doesn't speak or read
# Chinese or Korean won't catch. :)

:0
* SBDEBUG ?? yes
{
 INCLUDERC=${SBDIR}/sb-languages.rc
}

:0 E
* VIRUSTAG ?? no
* SPAMTAG ?? no
{
 INCLUDERC=${SBDIR}/sb-languages.rc
}

# PATTERN MATCHING
#
# Procmail weighted "scoring technique" used to analyze body text of
# email to spot spam which cannot be spotted by analyzing the headers
# of the spam -- spam sent from throwaway accounts or "whackamole"
# spam.
#
# The first recipe sets the email's default score at negative 1000 --
# only if the cumulative "score" of header and body string "hits", or
# recipes which result in a match, equals or exceeds 1000 will the
# email be tagged as probable spam with a Spam Rule of "Pattern Match"
# and diverted to the BLOCKFOLDER.
#
# The numbers between the "*" at the beginning of each condition and
# the start of the actual condition represent the score given to a
# match for that condition.  The first number represents the score
# for the first match.  The second number, after the caret "^", represents
# the exponent used to calculate the score for a second and subsequent
# matches.
#
# For example, a scoring formula of 100^1 means that the first match is
# given a score of 100, and subsequent matches are modified by an exponent,
# or "power", of one.  Since any number to the first power equals itself,
# this means that each match for this recipe will be given a score of 100.
# Ten such matches will result in a score of 1000, which (unless other
# recipes reduced this score) would cause the SpamBouncer to classify this
# particular piece of email as probable spam and divert it to the BLOCKFOLDER.
#
# A scoring formula of 300^.5 means that the first match is given a score
# of 300; the second of 300^.5, which is 150; the third a score of 300^(.5*2),
# which is 75, and so on.  The cumulative score would be 300+150+75....
# A recipe of this type weighs first mention of the suspect word or phrase
# more heavily than subsequent mentions, and thus avoids classifying email
# as spam based solely on the presence of a single suspect word or phrase
# since the cumulative score for any number of matches can never exceed a
# certain maximum number.
#
# A scoring formula of 50^2, on the other hand, weighs the first occurrence
# of a suspect word or phrase relatively lightly, but subsequent mentions
# ever more heavily.  This is useful for catching spam based on common spam
# keywords which may appear once or twice in non-spam email, but frequently
# appear many times in the text of a spam email.
#
# A scoring formula of 300^0 weighs the first occurrence of a suspect
# word or phrase at 300, and ignores subsequent matches.  This is useful
# for tests for a typical spam phrase in the Subject: header, where the
# phrase will not appear twice -- it speeds up processing.
#
# For more information on how Procmail Scoring works, consult the Procmail
# scoring manual on your system by typing "man procmailsc".

:0
{ RUNCHECK=no }

:0
* SBDEBUG ?? yes
{ RUNCHECK=yes }

:0
* VIRUSTAG ?? no
* SPAMTAG ?? no
* BLOCKTAG ?? no
{ RUNCHECK=yes }

:0
* PATTERNMATCHING ?? NONE
{
 :0 f
 | ${FORMAIL} -A"X-SBPass: No Pattern Matching"

 :0
 { RUNCHECK=no }
}

:0
* RUNCHECK ?? yes
{
 INCLUDERC=${SBDIR}/sb-pt-bogus_urls.rc
 INCLUDERC=${SBDIR}/sb-pt-disclaimer.rc
 INCLUDERC=${SBDIR}/sb-pt-html.rc
 INCLUDERC=${SBDIR}/sb-pt-bulk_email_advertising.rc
 INCLUDERC=${SBDIR}/sb-pt-cabletvdescrambler.rc
 INCLUDERC=${SBDIR}/sb-pt-chain_letters.rc
 INCLUDERC=${SBDIR}/sb-pt-collections.rc
 INCLUDERC=${SBDIR}/sb-pt-credit.rc
 INCLUDERC=${SBDIR}/sb-pt-detective.rc
 INCLUDERC=${SBDIR}/sb-pt-diploma.rc
 INCLUDERC=${SBDIR}/sb-pt-gambling.rc
 INCLUDERC=${SBDIR}/sb-pt-health.rc
 INCLUDERC=${SBDIR}/sb-pt-inkjet.rc
 INCLUDERC=${SBDIR}/sb-pt-insurance.rc
 INCLUDERC=${SBDIR}/sb-pt-jerks.rc
 INCLUDERC=${SBDIR}/sb-pt-jobs.rc
 INCLUDERC=${SBDIR}/sb-pt-legal.rc
 INCLUDERC=${SBDIR}/sb-pt-mmf.rc
 INCLUDERC=${SBDIR}/sb-pt-money.rc
 INCLUDERC=${SBDIR}/sb-pt-mortgage.rc
 INCLUDERC=${SBDIR}/sb-pt-onlinebiz.rc
 INCLUDERC=${SBDIR}/sb-pt-pharmacy.rc
 INCLUDERC=${SBDIR}/sb-pt-stock.rc
 INCLUDERC=${SBDIR}/sb-pt-webdesign.rc
 INCLUDERC=${SBDIR}/sb-pt-webhost.rc
 INCLUDERC=${SBDIR}/sb-pt-websitetraffic.rc
 INCLUDERC=${SBDIR}/sb-pt-websurf.rc
 INCLUDERC=${SBDIR}/sb-pt-weight_loss.rc
 INCLUDERC=${SBDIR}/sb-pt-work_from_home.rc
 INCLUDERC=${SBDIR}/sb-pt-xxx.rc
 INCLUDERC=${SBDIR}/sb-pt-other_patterns.rc
 INCLUDERC=${SBDIR}/sb-pt-spamsubjects.rc
}
# End PATTERNMATCHING Section


# IRRESPONSIBLE PROVIDERS AND SPAMMY NETBLOCKS
#    (ISPs and NSPs which host a lot of spam sites, and which do not have
#     adequate AUP/TOS or ignore them, but which also have non-spamming
#     customers.)

:0
* SBDEBUG ?? yes
{
 INCLUDERC=${SBDIR}/sb-blockips.rc
 INCLUDERC=${SBDIR}/sb-blockdomains.rc
}

:0 E
* VIRUSTAG ?? no
* SPAMTAG ?? no
* BLOCKTAG ?? no
{
 INCLUDERC=${SBDIR}/sb-blockips.rc
 INCLUDERC=${SBDIR}/sb-blockdomains.rc
}

# OPT-OUT MAILING LISTS
#    ISPs and companies with opt-out mailing lists.

:0
* SBDEBUG ?? yes
{
 INCLUDERC=${SBDIR}/sb-blockool.rc
}

:0 E
* VIRUSTAG ?? no
* SPAMTAG ?? no
* BLOCKTAG ?? no
{
 INCLUDERC=${SBDIR}/sb-blockool.rc
}

# Retired Spamhouses
#  Former spam sites which have quit spamming, but not officially renounced
#  spamming, are moved here after three to six months of no spam.  After
#  another three to six months of no spam, they are dropped from the
#  SpamBouncer.

:0
* SBDEBUG ?? yes
{
 INCLUDERC=${SBDIR}/sb-retired.rc
}

:0 E
* VIRUSTAG ?? no
* SPAMTAG ?? no
* BLOCKTAG ?? no
{
 INCLUDERC=${SBDIR}/sb-retired.rc
}

# Free email sites
:0
{ RUNCHECK=no }

:0
* SBDEBUG ?? yes
{ RUNCHECK=yes }

:0E
* VIRUSTAG ?? no
* SPAMTAG ?? no
* BLOCKTAG ?? no
{ RUNCHECK=yes }

:0
* FREEMAIL ?? NONE
{
 :0 f
 | ${FORMAIL} -A"X-SBPass: No Freemail Filtering"

 :0
 { RUNCHECK=no }
}

:0
* RUNCHECK ?? yes
{
 INCLUDERC=${SBDIR}/sb-freemail.rc
}


# BLOCKED EMAIL NOTIFICATION ROUTINE
:0
* BLOCKTHIS ?? yes
* !ADMINTAG ?? yes
* !BULKTAG ?? yes
* !VIRUSTAG ?? yes
{
 :0
 { BLOCKPID=`echo $$` }

 :0 c:
 blocktemp.${BLOCKPID}

 :0 c: blocktemp.${BLOCKPID}.lock
 | (${FORMAIL} -rt \
    -I"From: ${ALTFROM}" \
    -A"X-Loop: ${NOLOOP}";\
    cat ${SBDIR}/notify;\
    echo " ********** The password is ${BYPASSWD}. **********";\
    echo " ";\
    echo "=-=-=-=-=-=-=-=-=-=";\
    echo " ";\
    cat blocktemp.${BLOCKPID};\
    ${RM} -f blocktemp.${BLOCKPID}) \
    | ${SENDMAIL} -oi -t
}

# BOUNCE ROUTINE
:0
* BOUNCETHIS ?? yes
* !ADMINTAG ?? yes
* !BULKTAG ?? yes
* !VIRUSTAG ?? yes
{
 :0
 { BOUNCEPID=`echo $$` }

 :0 c:
 bouncetemp.${BOUNCEPID}

 :0
 { SPAMFROM=`${FORMAIL} -rt -xTo:` }

 :0
 { SPAMERROR=`${FORMAIL} -xErrors-To:` }

 :0
 { SPAMDATE=`date` }

 :0 c: bouncetemp.${BOUNCEPID}.lock
 | (${FORMAIL} -rt \
    -I"From: MAILER-DAEMON@${HOST}.${DOMAIN} (Mail Delivery Subsystem)" \
    -I"Subject: Returned mail: User unknown" \
    -I"Auto-Submitted: auto-generated (failure)" \
    -A"Bcc: ${SPAMERROR}" \
    -A"X-Loop: MAILER-DAEMON@${HOST}.${DOMAIN}";\
     echo "The original message was received at ${SPAMDATE}";\
     echo "from ${SPAMFROM}";\
     echo " ";\
     echo "----- The following addresses had permanent fatal errors -----";\
     echo "${LOGNAME}@${HOST}.${DOMAIN}";\
     echo " ";\
     echo "----- Transcript of session follows -----";\
     echo "... while talking to ${HOST}.${DOMAIN}:";\
     echo ">>> RCPT To:<${LOGNAME}@${HOST}.${DOMAIN}>";\
     echo "<<< 550 Bad recipient";\
     echo "550 ${LOGNAME}@${HOST}.${DOMAIN}... User unknown";\
     echo "Reporting-MTA: dns; ${HOST}.${DOMAIN}";\
     echo " ";\
     echo "Arrival-Date: ${SPAMDATE}";\
     echo "Final-Recipient: RFC822; ${LOGNAME}@${HOST}.${DOMAIN}";\
     echo "Action: failed";\
     echo "Status: 5.1.1";\
     echo "Diagnostic-Code: SMTP; 550 Bad recipient";\
     echo "Last-Attempt-Date: ${SPAMDATE}";\
     ${RM} -f bouncetemp.${BOUNCEPID}) \
     | ${SENDMAIL} -oi -t
}

}
# End of :0 E wrapper around NOLOOP

}
# End of :0 E wrapper around BYPASSWD

}
# End of :0 E wrapper around MAILER-DAEMON

}
# End of :0 E wrapper around WHITELIST

}
# End of :0 E wrapper around LEGITLISTS

}
# End of :0 E wrapper around ALWAYSBLOCK

}
# End of :0 E wrapper around GLOBALNOBOUNCE

}
# End of :0 E wrapper around NOBOUNCE

}
# End of :0 E wrapper around > 1 MB size filter

}
# End of :0 E wrapper around Virus Filter

}
# End of :0 E wrapper around BOUNCESANDSTUFF

}
# End of :0 E wrapper around Critical Variables check

:0 f
* VIRUSTAG ?? yes
| ${FORMAIL} -A"X-SBClass: Virus"

  :0 Aw
  * !FILTER ?? yes
  ${VIRUSFOLDER}

:0 f
* SPAMTAG ?? yes
* !VIRUSTAG ?? yes
| ${FORMAIL} -A"X-SBClass: Spam"

  :0 Aw
  * !FILTER ?? yes
  ${SPAMFOLDER}

:0 f
* BLOCKTAG ?? yes
* !VIRUSTAG ?? yes
* !SPAMTAG ?? yes
| ${FORMAIL} -A"X-SBClass: Blocked"

  :0 Aw
  * !FILTER ?? yes
  ${BLOCKFOLDER}

:0 f
* ADMINTAG ?? yes
* !VIRUSTAG ?? yes
* !SPAMTAG ?? yes
* !BLOCKTAG ?? yes
| ${FORMAIL} -A"X-SBClass: Admin"

  :0 Aw
  * !FILTER ?? yes
  ${ADMINFOLDER}

:0 f
* BULKTAG ?? yes
* !ADMINTAG ?? yes
* !VIRUSTAG ?? yes
* !SPAMTAG ?? yes
* !BLOCKTAG ?? yes
| ${FORMAIL} -A"X-SBClass: Bulk"

  :0 Aw
  * !FILTER ?? yes
  ${BULKFOLDER}

:0 f
* !BULKTAG ?? yes
* !ADMINTAG ?? yes
* !VIRUSTAG ?? yes
* !SPAMTAG ?? yes
* !BLOCKTAG ?? yes
| ${FORMAIL} -A"X-SBClass: OK"

LINEBUF=${OLDLINEBUF}

# DEBUG
:0
* DEBUG ?? yes
{ VERBOSE=${OLDVERBOSE} }

