Mailing List Archive

Support open source code!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mail filtering

On Fri, Nov 24, 2000 at 05:07:30PM +0900, B0Ti wrote:
> I'd like to do mail filtering on a system (I think it is IRIX), which
> doesn't have procmail, filter, mailagent installed.
> What other unix tools would accomplish a similar task ?
May I humbly suggest Mail::Audit, a very simple Perl module? You can
download and run it as a user, and it's (in my humble opinion) much easier
to use than procmail. (That is, if you know Perl) 

It's also far more powerful. Consider:

use lib "/home/simon/plib/"; # This is where your modules are installed
use Mail::Audit;
open (LOG, ">>/home/simon/.audit_log"); # Don't die on failure, we'll lose mail!
$folder ="/home/simon/mail/";

my $item = Mail::Audit->new();

my $from = $item->from();
my $to = $item->to();
my $cc = $item->cc();
my $subject = $item->subject();

my %lists = (
    "tlug"          => "tlug",
    "perl5-porters" => "p5p",
    # ...

for my $what (keys %lists) {
  my $where = $lists{$what};
  if ($from =~ /$what/i or $to =~ /$what/i or $cc =~/$what/i) {
    print LOG "INCOMING MAIL:$from:$subject:List $where\n";

for ( {
  if ($from =~ /$_/i) {
    print LOG "INCOMING MAIL:$from:$subject:Rejected - spam\n";
    $item->reject("We do not accept spam");

# Query mail that is not addressed to me.
if ($to !~ /simon|pemb0468/ and $cc !~ /simon|pemb0468/) {
  print LOG "INCOMING MAIL:$from:$subject:Spam?? (Questionable)\n";
  $item->accept($folder."questionable"); # For the time being.

$item->accept(); # Put it in the inbox
My sister married a German. He complained he couldn't get a good bagel back 
home. I said: 'Well, whose fault is that?' - Emo Philips

Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links