Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!orc!inews!iwarp.intel.com!news From: merlyn@iwarp.intel.com (Randal Schwartz) Newsgroups: comp.lang.perl Subject: Re: Perly mail filters (?) Message-ID: <1990Sep5.161205.26295@iwarp.intel.com> Date: 5 Sep 90 16:12:05 GMT References: <90Sep5.070222edt.18759@me.utoronto.ca> Sender: news@iwarp.intel.com Reply-To: merlyn@iwarp.intel.com (Randal Schwartz) Distribution: comp Organization: Stonehenge; netaccess via Intel, Beaverton, Oregon, USA Lines: 71 In-Reply-To: eastick@me.utoronto.ca (Doug Eastick) In article <90Sep5.070222edt.18759@me.utoronto.ca>, eastick@me (Doug Eastick) writes: | Ok JAPHs, what do some of you use to filter your incoming mail? I've | been using filter(1) which comes with ELM but it is quite simple and | doesn't handle regexp's. | | I'd like to be able to save/delete incoming mail based on things in | From: | Subject: | | Or, as a last resort, just something (efficient) which will tear apart the | header for me and I'll go from there. Here's what I'm doing for the moment. My particular application involves taking the mail, recording the headers into a log-file (so that I can see how things are being addressed to me at a glance... I'm eventually interested in a lwall-like mail response daemon), and then stuff the body of the article into MH's rcvstore so that it gets "inc"-ed into my incoming mailbox automatically. I have "|/j/merlyn/.mailman" in my ".forward" file. It might be rough, but it should be a start... ================================================== snip here #!/local/usr/bin/perl %newENV = ( 'HOME', '/j/merlyn', 'PATH', '/local/merlyn/bin:/local/usr/bin:/usr/ucb:/bin:/usr/bin', 'SHELL', '/bin/sh', 'USER', 'merlyn', ); for (keys ENV) { delete $ENV{$_}; $ENV{$_} = $newENV{$_} if defined $newENV{$_}; } chdir; open(STDOUT,">>.mailmanlog") || die "Cannot open .mailmanlog ($!)"; open(STDERR,">&STDOUT"); flock(STDOUT,2); # lock_ex seek(STDOUT,0,2); # in case someone else had it while we were waiting $message = join("",); ($_ = $message) =~ s/\n\n[^\0]*/\n/; s/\n(\s+)/\377\1/g; # hide continuations @headerlines = split(/\n/); for $h (split(/\s+/,<