Reducing Spam

These are the recommendations that I have found elsewhere on the web

Adding the RBL

There appear to be three copies of sendmail.cf on a Westhost system. These are located at /usr/share/sendmail/sendmail.cf, /etc/sendmail.cf and /etc/mail/sendmail.cf.  However the first two are symbolic links – the one in /etc/mail is the one we are interested in. The file /etc/mail/sendmail.mc is a complete set of m4 macros needed to generate a fresh /etc/mail/sendmail.cf – backup your existing sendmail.cf file before making any changes! (Use the command cp -p to /etc/mail/sendmail.cf /etc/mail/sendmail.bak to preserve the modification date and ownerships).  Then open sendmail.mc in your favourite text editor and add this to the end of the file.


FEATURE(`dnsbl',`sbl-xbl.spamhaus.org',`"554 Rejected " $&{client_addr} " found in sbl-xbl.spamhaus.org"')dnl
FEATURE(`dnsbl',`bl.spamcop.net',`"554 Rejected " $&{client_addr} " found in bl.spamcop.net"')dnl
FEATURE(`dnsbl',`dnsbl.njabl.org',`"554 Rejected " $&{client_addr} " found in dnsbl.njabl.org"')dnl

You will also need to enable Delay_Check by removing the first dnl from


dnl FEATURE(delay_checks)dnl

so that it becomes


FEATURE(delay_checks)dnl

Anything to the right of dnl is a comment in sendmail.mc (BEWARE! Macros will be expanded so don’t include them). 

I have given three examples, however there are other lists which you could use.
Strictly speaking, only one list is required.  In fact more then one will cause a performance hit but will catch more spam so it is up to you as to what your needs are. You could even include more – MAPS maintains 3 different lists plus a fourth that includes all three but they now charge for access if your site is in any way commercial.

After adding those lines to your sendmail.mc file all you need to do is execute the following command from the /etc/mail dir.

m4 sendmail.mc > ./sendmail.cf

After running the m4 command restart your VPS and you are done. If you have set up your mail server to use sbl.spamhaus.org, you can test to see if the SBL blocking is working by sending an email (any email) to nelson-sbl-test@crynwr.com. (You must send the email from the mail server which you wish to test). The Crynwr system robot will answer you to tell you if your server is correctly blocking SBL-listed IPs or not. If you have done everything right then you will get the reply

Testing your SBL block. See http://www.crynwr.com/spam/ for more info.
Please note that this test will not tell you if your server is open for
relaying. Instead, it tests to see if your server blocks email from IP
addresses listed in various blocking lists; in this case, the SBL list.

Here’s how the conversation looked from sbl.crynwr.com.
Note that some sites don’t apply the SBL block to postmaster, so
I use your envelope sender as the To: address.

I connected to xxx.xxx.xxx.xxx and here’s the conversation I had:

220 yourdomain.com ESMTP Sendmail 8.11.6/8.11.6; Tue, 17 Oct 2006 05:23:36 -0600
helo sbl.crynwr.com
250 yourdomain.com Hello sbl.crynwr.com [192.203.178.107], pleased to meet you
mail from:<>
250 2.1.0 <>… Sender ok
rcpt to:
554 5.7.1 Rejected 192.203.178.107 found in sbl-xbl.spamhaus.org
Terminating conversation

You can always change the LogLevel in your sendmail.cf from 0 to 9 to help troubleshoot. This creates the log file /var/log/maillog. Remember to reset the LogLevel to 0 (zero) once you have fixed the problem