Next: , Previous: The problem of spam, Up: Thwarting Email Spam

9.16.2 Anti-Spam Basics

One way of dealing with spam is having Gnus split out all spam into a ‘spam’ mail group (see Splitting Mail).

First, pick one (1) valid mail address that you can be reached at, and put it in your From header of all your news articles. (I've chosen ‘’, but for many addresses on the form ‘’ will be a better choice. Ask your sysadmin whether your sendmail installation accepts keywords in the local part of the mail address.)

     (setq message-default-news-headers
           "From: Lars Magne Ingebrigtsen <>\n")

Then put the following split rule in nnmail-split-fancy (see Fancy Mail Splitting):

      (to ""
          (| ("subject" "re:.*" "misc")
             ("references" ".*@.*" "misc")

This says that all mail to this address is suspect, but if it has a Subject that starts with a ‘Re:’ or has a References header, it's probably ok. All the rest goes to the ‘spam’ group. (This idea probably comes from Tim Pierce.)

In addition, many mail spammers talk directly to your SMTP server and do not include your email address explicitly in the To header. Why they do this is unknown—perhaps it's to thwart this thwarting scheme? In any case, this is trivial to deal with—you just put anything not addressed to you in the ‘spam’ group by ending your fancy split rule in this way:

      (to "larsi" "misc")

In my experience, this will sort virtually everything into the right group. You still have to check the ‘spam’ group from time to time to check for legitimate mail, though. If you feel like being a good net citizen, you can even send off complaints to the proper authorities on each unsolicited commercial email—at your leisure.

This works for me. It allows people an easy way to contact me (they can just press r in the usual way), and I'm not bothered at all with spam. It's a win-win situation. Forging From headers to point to non-existent domains is yucky, in my opinion.

Be careful with this approach. Spammers are wise to it.