Although Perl is a great tool for this sort of thing, there are others as well, most notably Procmail. And there's an excellent filter system called the Spam Bouncer which consists of a bunch of procmail scripts which does just what you want. See http://www.spambouncer.org/ for more info.
--Bill. Scott R. Godin writes: >has anyone implemented a 'better version' of the vacation program for >themselves? > >I'm particularly interested in 'screening' the bulk-mail type messages >that list me in their "bcc:" header so that my address does not show up >in the "from:" or "cc:" address listings, thus preventing >/usr/bin/vacation from triggering and sending the response. =:P (fat lot >of good that does me) > >I've noticed that near 99% of the spam I receive uses this method to >mask it from reciept, so typically I filter this with my mailer into a >dumping ground, but the sheer amount of spam lately (235 items since Nov >5th) has caused me to form a desire to tackle this more forthrightly and >aggressively. > >Ideally, it should return the offending mail to postmaster@* (where * is >the supposed 'from' address) to report the abuse, and include a full >copy of the original message including headers (along with a nice terse >little message regarding the laws involved). Additionally it would be >nice if it could forward the spam to my OWN postmaster for additional >reportage and filtering at their end. > >I'm quite unsure how to go about this. I'm loathe to start messing with >it without some direction, against the possibility of perhaps breaking >things or doing it VERY wrongly and seriously pissing off my own >postmaster hehe ;) without some starting point references to work from, >and I don't have a testbed here to play with, until my friend finishes >the work on the redhat box he's been tossing together for me in his free >time. :-) > >Can you kind folks offer some pointers to me as to how I can go about >such a task, and what would be some of the traps and pitfalls to avoid >(of which I'm quite sure there are many) in the process? > >I'm very anxious to get back at these spamming bastards somehow, as this >intrusion into my personal e-mail is MOST unwelcome, and I've got a >growing passion to stamp out this *expletive deleted* practice as often >as I can. > >Hitting them where it hurts with *minimal* manual intervention, seems >the best way. >;D > >I've considered also, the possibility of stuffing them in a database, >and then periodically checking it interactively with the program, and >triggering 'bounce' type messages to said postmasters on a specific >basis -- as this way I don't auto-trigger "I'm-annoyed-by-your-spam" >responses for *legitimate* 'bcc' messages. > > something sort of like an > $ ~/bin/vacation.pl -X (where X will be whatever flag I decide on to >enter the database processing stage) > > You have (n) messages in your holding cell. Proceed? (y/n) _ > <list of from/subject lines, numbered> > Enter a Selected line number, or 'a' for all. [#/a] _ > <message headers> > Preview, Accept, Bounce, Delete [p/a/b/d]? _ >(if Preview is selected) > <message body> > Accept, Bounce, Delete, >Mark-this-Entire-Domain-as-SPAM-source-for-all-time-and-bounce-and-report >-all-instances :D [a/b/d/m]? _m > > Domain 'btamail.net.cn' Captured. OK? > <Return to accept, or enter corrections>: _ > >(where (A)ccept could possibly add the From address to a list of >acceptable e-mails that get passed through automatically from then on. >:-) as well as passing the mail on to my proper inbox, just like a >\$user in my .forward file would. > >this is just a stray shell account, that I retain around on my prior ISP >for testing purposes, perl-wise, and in case some people still haven't >upgraded their addressbooks, so delaying the mail a bit won't kill me. >(particularly considering the volume of spam it's recieving lately) I >don't even get 1/20th the amount of spam to other accounts I have. :/ > >With enough pointers, I think I can complete the beastie -- I mean I DO >have a pretty complete 'vision' of what I want. :-) I just need some >pointers on how to get there. I'll happily contribute this pup to the >CPAN scripts archive if I can get it working exactly the way I want it >to. I'm SURE some of you could find a use for it. ;) > >Your thoughts and contemplations are anticipated with great desire and >gleeful hand-rubbings and evil-grinning eyebrow-wagglings to "Make it >so." > >If stuff like this isn't one of the things that makes Perl so "fun" I >dunno what is. :D > >(note that while I'm sort of broad-casting my initial hopes on this to >four groups on perl.org (perl.scripts, perl.beginners, >perl.macperl.anyperl, perl.fwp), I'm confining responses (via reply-to >and followup-to) to > > [EMAIL PROTECTED] >aka nntp://nntp.perl.org/perl.scripts/ > >to consolidate things and reduce the required effort of following this >thread to a single track. I hope this is the proper way to go about it >-- despite years of experience with cross-posting on usenet, this is the >first time I've thought about doing such a thing on a group that was >also mirrored out as a mailing list. :\ Apologies and if this is the >wrong thing to do, will the moderators let me know in private, and I'll >do what I can to correct it. :) > >print pack "H*", "4a75737420416e6f74686572204d61635065726c204861636b65722c0d"; >-- >Scott R. Godin | e-mail : [EMAIL PROTECTED] >Laughing Dragon Services | web : http://www.webdragon.net/ >It is not necessary to cc: me via e-mail unless you mean to speak off-group. >I read these via nntp.perl.org, so as to get the stuff OUT of my mailbox. :-) -- William R Ward [EMAIL PROTECTED] http://www.wards.net/~bill/ ----------------------------------------------------------------------------- If you're not part of the solution, you're part of the precipitate. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]