procmail
[Top] [All Lists]

Re: spam filter ?

2000-09-15 11:17:35
At 16:27 2000-09-15 +0200, Johannes Zellner wrote:
> can someone give me a simple procmail recipe to filter
> spam mails ? -- I've several addresses which are considered
> to be spam. Ideally the recipe should
>    1) save the spam to /dev/null

For later retreival of course! <g>

>    2) notify the sender that the mail is considered to be
>       spam and therefore beeing killed.

Bad idea. If you've got a couple of _twit_ addresses, you might do this, but don't do it for spam. You can simulate a mail delivery error if you wanted to. The exitcode scheme you're using below makes more sense if you must send something back - you're (hopefully) giving them the impression that they should stop wasting their time by sending you mail.

It looks like you're running Exim on Debian. I'm unfamiliar with Exim, but perhaps it has something like the Sendmail "access" feature - there's a file you can enter some really basic rules into to define who to bounce mail from, and what SMTP error code to return. This takes place at the SMTP level, and has the benefit of being able to reject messages before the BODY is accepted by your server (at the point at which procmail has a message to parse, you've already taken the network brunt of the message).

It takes a special breed of twit for me to put them in the access database, but it's downright fun when I do.

or: how can I `or' together the addresses ?

most basic way, just put a vertical bar between the address elements:
* ^From:.*@(china\.com|msn\.com)

More complex:
* ^From:.*@(china|msn)\.com

(as you add .net and .org, etc, you need to get slightly more creative here, but if you get an understanding of regular expressions, it is pretty simple).

If you're unsure of the regexp, I'd suggest you file your "spam" into a folder, so accidents can be recovered from (using formail to split the folder back up, of course).

[snip]

   0:
   ^^^
        :0

---
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.

 Sean B. Straw / Professional Software Engineering
 Post Box 2395 / San Rafael, CA  94912-2395


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>