procmail
[Top] [All Lists]

Re: Blacklist via mail folder

2004-11-02 04:22:10
On Mon, Nov 01, 2004 at 05:45:37PM -0500, Poohba wrote:
[silly top-posting fixed]

On Mon, 2004-11-01 at 12:54, Dallman Ross wrote:
On Mon, Nov 01, 2004 at 10:03:52AM -0500, Poohba wrote:
I heard of this but I can't seem to find the email that tells how to do
this.  I want to put emails in a mail folder (file) and use that to
check for unwanted address.

You need to be a little more specific about what addresses you want
to grab from there.  Sender?  Putative From:?  Bogus addresses in
the To: or Cc: lines?  Or do you mean you want to grep all that cruft

The address I want is the sender and from I guess.  Which is suggested
to go by?

As I stated, the suggestion is that you not use this method.
Think about it: for evey email your server receives, you intend
to parse through all headers of all email sitting in your spam pile.
That's a lot of work!

If we use formail to grab the From_ header  -- mind, it gets much more
complicated to grab multiple header fields that way and still have them
all formatted as only an email address, which is what we would want --
it still means that formail has to cycle through all messages in your
spam pile every time a new message comes into your server, and formail
will be extracting all those From_ fields recursively.  Bah.

It's not completely crazy, but it's a lot of make-work for your
server for no good reason that I can see.

I'd suggest perhaps having a cron job running daily to do the formail
extraction I offered --

  formail -IReply-To: -fzrx To: -s < myspam

and save the output to a file that is what you will grep in procmail.

Then you can check the copious examples that you will find in the procmail
list archives for grepping flat files for blacklist info.

If you absolutely insist on doing what you asked, then I already
gave you everything you need to do it except for the final procmail
recipe that implements it.  That would be:

  CLEANFROM = `formail -IReply-To: -fzrx To:`

  :0:
  * ? formail -IReply-To: -fzrx To: -s < myspam | fgrep -wis -e $CLEANFROM
  morespam

Note that you can't write the spam to myspam, because you are grepping myspam
concommitantantly.  (I.e., you will have a loop that will bring down your
server.)  Thus, there is no easy "live" solution with mbox-style files that
doesn't require lots more coding.  You could use dir-grepping, perhaps, to
achieve the "live" advantage, but I don't feel like testing it to see for sure.

-- 
dman

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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