1# DELIVERY.RC
2#
3# A file of recipes to deliver email after it has been filtered
4# by the SpamBouncer, that provides a few more options and
5# somewhat more flexibility than the SpamBouncer's own delivery
6# options.
7#
8# NOTE: Add the variables beneath this note section to the
9# Variables section at the top of your .procmailrc file.  DO
10# NOT PUT THEM AT THE BOTTOM OF THE FILE! Change the values to
11# fit your local system.
12#
13# The SBDELIVERY setting tells the SpamBouncer not to use its
14# own internal delivery procedures, but to filter email and then
15# return it to the ongoing procmail mail stream, so that you can
16# continue filtering it and deliver it as you want.
17#
18# The NEWMAIL file is a file of non-whitelisted email that also
19# isn't classified as spam or blocked. You can use it to separate
20# whitelisted email/known good email from other email if you want.
21# If you don't want to separate them, just change the line below
22# to NEWMAIL=${DEFAULT}, and non-whitelisted email will be sent
23# to your inbox just as whitelisted email is.
24#
25# The QUARANTINE file is a file of suspected viruses, trojans,
26# or email containing other types of content that might hijack
27# your computer or have other effects you don't expect. :/  I
28# highly recommend examining such email on a Unix server, if
29# you can.  Most of it is dangerous only to Microsoft Windows
30# computers.
31#
32# You might also want to set VIRUSFOLDER=/dev/null to ensure that
33# viruses get deleted outright.  The virus filters have almost
34# never generated a false positive, and viruses pile up these days
35# because there are so many of them.  Nuking them saves disk
36# space.
37
38# NEWMAIL=${MAILDIR}/new.incoming
39# QUARANTINE=${MAILDIR}/quarantine.incoming
40# SBDELIVERY=FILTER
41# VIRUSFOLDER=/dev/null
42
43# NOTE: You can use these scripts one of two ways:
44#
45#       * You can insert them into your .procmailrc file,
46#         at the bottom.
47#
48#       * You can save them as a separate file -- I call mine
49#         "delivery.rc" -- in your home directory, and then
50#         reference that file at the bottom of your .procmailrc
51#         as follows:
52#
53#         INCLUDERC=${HOME}/delivery.rc
54#
55# If you receive legitimate email in Chinese, Japanese, Korean
56# or Russian (four languages in which a lot of spam is sent, and
57# which many people cannot read and never receive as legitimate
58# email), you need to edit the "Useless Cr*p" section to remove
59# the appropriate lines.  You can just delete the line on which
60# the language appears and the recipe will be otherwise intact.
61
62# File Whitelisted Email
63:0:
64* ^X-SBPass: (GlobalNoBounce|NoBounce|Whitelisted)$
65| ${FORMAIL} -A"X-Folder: Whitelisted" >>${DEFAULT}
66
67# File Viruses
68:0:
69* ^X-SBClass: Virus$
70| ${FORMAIL} -A"X-Folder: Virus" >>${VIRUSFOLDER}
71
72# File Dangerous Content. Put emails with Dangerous
73# Content from addresses in your NOBOUNCE or GLOBALNOBOUNCE
74# files into the QUARANTINE folder.  Put other such
75# emails in the SPAMFOLDER.
76
77LOCALTAG=no
78
79:0
80* ^X-SBStop: DANGER!
81{
82 :0
83 * ! FROMEMAIL ?? ^noemail@example.com$
84 * ? ${GREP} -i -x "${FROMEMAIL}" ${NOBOUNCE}
85 { LOCALTAG=yes }
86
87 :0
88 * ! LOCALTAG ?? yes
89 * ! REPLYTOEMAIL ?? ^noemail@example.com$
90 * $ ! REPLYTOEMAIL ?? ^${FROMEMAIL}$
91 * ? ${GREP} -i -x "${REPLYTOEMAIL}" ${NOBOUNCE}
92 { LOCALTAG=yes }
93
94 :0
95 * ! LOCALTAG ?? yes
96 * ! FROMDOMAIN ?? ^example.com$
97 * ? ${GREP} -i -x "${FROMDOMAIN}" ${NOBOUNCE}
98 { LOCALTAG=yes }
99
100 :0
101 * ! LOCALTAG ?? yes
102 * ! FROMDOMAIN ?? ^example.com$
103 * $ ! REPLYTODOMAIN ?? ^${FROMDOMAIN}$
104 * ? ${GREP} -i -x "${REPLYTODOMAIN}" ${NOBOUNCE}
105 { LOCALTAG=yes }
106
107 :0
108 * ! FROMEMAIL ?? ^noemail@example.com$
109 * ? ${GREP} -i -x "${FROMEMAIL}" ${GLOBALNOBOUNCE}
110 { LOCALTAG=yes }
111
112 :0
113 * ! LOCALTAG ?? yes
114 * ! REPLYTOEMAIL ?? ^noemail@example.com$
115 * $ ! REPLYTOEMAIL ?? ^${FROMEMAIL}$
116 * ? ${GREP} -i -x "${REPLYTOEMAIL}" ${GLOBALNOBOUNCE}
117 { LOCALTAG=yes }
118
119 :0
120 * ! LOCALTAG ?? yes
121 * ! FROMDOMAIN ?? ^example.com$
122 * ? ${GREP} -i -x "${FROMDOMAIN}" ${GLOBALNOBOUNCE}
123 { LOCALTAG=yes }
124
125 :0
126 * ! LOCALTAG ?? yes
127 * ! FROMDOMAIN ?? ^example.com$
128 * $ ! REPLYTODOMAIN ?? ^${FROMDOMAIN}$
129 * ? ${GREP} -i -x "${REPLYTODOMAIN}" ${GLOBALNOBOUNCE}
130 { LOCALTAG=yes }
131
132 :0:
133 * LOCALTAG ?? yes
134 | ${FORMAIL} -A"X-Folder: Quarantine" >>${QUARANTINE}
135
136 :0:
137 * LOCALTAG ?? no
138 | ${FORMAIL} -A"X-Folder: Spam" >>${SPAMFOLDER}
139}
140
141# File Spam
142:0:
143* ^X-SBClass: Spam$
144| ${FORMAIL} -A"X-Folder: Spam" >>${SPAMFOLDER}
145
146# File Useless Cr*p
147:0 D:
148* ^X-SBRule: (.* is in CBL.*|\
149              .* is in OPM.*|\
150              .* is in SBL.*|\
151              .* is in XBL.*|\
152	      .*Chinese|\
153	      .*Japanese|\
154	      .*Korean|\
155	      .*Russian|\
156	      Defanged Virus.*|\
157              Spam Haven Domain.*|\
158              Spam Haven IP.*|\
159              Unnecessary Base64 Encoding|\
160	      .*Virus Notification.*)$
161| ${FORMAIL} -A"X-Folder: Spam" >>${SPAMFOLDER}
162
163# File Blocked Email
164:0:
165* ^X-SBClass: Blocked$
166| ${FORMAIL} -A"X-Folder: Blocked" >>${BLOCKFOLDER}
167
168# File Bulk
169:0:
170* ^X-SBClass: Bulk$
171| ${FORMAIL} -A"X-Folder: Bulk" >>${BULKFOLDER}
172
173# File Admin
174:0:
175* ^X-SBClass: Admin$
176| ${FORMAIL} -A"X-Folder: Admin" >>${ADMINFOLDER}
177
178# File Remainder
179:0:
180| ${FORMAIL} -A"X-Folder: New Mail" >>${NEWMAIL}
181
182