- I have not had this running for very long, so if there are long-term problems this causes, I don't know yet.
- You can screw up sendmail if you do this wrong! Please don't try this if you don't know what you are doing.
- Any alabanza upgrade of sendmail will wipe out this change, so you'll have to do it again.
- Some people have philosophical problems with RBLs because they think they can block legitimate email. With over 60% of all email being spam, I decided to scrap my philosophy.
- I'm sure if you have problems that Alabanza will not support this change.
Anyway, here are the directions.
(1) Backup /etc/mail/sendmail.cf
cp /etc/mail/sendmail.cf /etc/mail/sendmail.cf.backup
(if you skip this step, you are an idiot

(2) Open the file /etc/mail/sendmail.cf and find the line that says:
### check_mail -- check SMTP `MAIL FROM:' command argument
(3) Right ABOVE that line add the following:
R$* $: $&{client_addr}
R::ffff:$-.$-.$-.$- $: <?> $(host $4.$3.$2.$1.sbl.spamhaus.org. $:OK $)
R$-.$-.$-.$- $: <?> $(host $4.$3.$2.$1.sbl.spamhaus.org. $:OK $)
R<?>OK $: OKSOFAR
R<?>$+ $#error $@ 5.7.1 $: "Mail from " $&{client_addr} " Email blocked using spamhaus - see <http://spamhaus.org/>"
A few notes on the above:
- It is 5 lines, each starting with "R". Some may line-wrap on this post, but each of the 5 lines needs to be only on one line.
- There are tabs in the middle of each line (before the $: on the first four lines, and before the $#error on the last line); they MUST be tabs, not spaces. So when you copy and paste, you'll probably have to replace the spaces with tabs. If you don't use tabs, you'll get an error message when restarting sendmail. See the lines above the ones you are inserting in sendmail.cf to see the proper format.
(4) Restart sendmail:
/etc/rc.d/init.d/sendmail stop
killall -9 sendmail
/etc/rc.d/init.d/sendmail start
(5) Check that it is running:
ps aux | grep sendmail
You can add other RBL's as well as spamhaus - just replace the sbl.spamhaus.org with another RBL and change the error message. Some others to consider (which I have NOT implemented yet):
bl.spamcop.net
relays.ordb.org
ipwhois.rfc-ignorant.org
list.dsbl.org
opm.blitzed.org
dnsbl.njabl.org
relays.visi.com
What will happen after this is implemented is that any email coming from an IP address on the RBL will be automatically rejected. If it is a "legit" message, the sender will be told that they were rejected and why. In my experience, this happens VERY infrequently, but you may have a different experience.