( gigalomania | 2010. 01. 02., szo – 19:04 )

Szia

Én ezzel a szkripttel csináltam meg.
A postfix master.cf-ben:
filter unix - n n - - pipe
flags=Rq user=filter argv=/usr/sbin/spamfilter.sh -f ${sender} -- ${recipient}

spamfilter.sh:
#!/usr/bin/perl -w
#
# This reads in input on stdin, sees if it contains X-Spam-Status: Y,
# and if it does it prints out nothing, and exit(0)'s.
# Else it prints out the mail message (for local delivery
# through sendmail)
sub debug {
my $message = shift;
chomp $message; # remove line ending if there is one
# open /var/log/spamlog in append mode, if we can't warn and return.
open(LOG, ">>/var/log/spamlog") or warn ("Debug Failed: $message") and return;
print LOG $message . "\n";
close(LOG);
}

# debug ("Spam Check starting..");
undef $/; # change line seperator
$_ = ; # read standard input (i.e. what's being piped in)

if ($_ =~ /^X-Spam-Status: Y/m ) {
# debug("spam detected, skipping ") ;
exit 0;
}

debug("Mail ok : $_");
my $prog = "/usr/sbin/sendmail -i @ARGV";
# debug("Program set to : $prog");
open PROG, "|$prog" or die "Cannot spawn |$prog: $!";
print PROG $_;
close PROG;

Ha van valami kérdésed szólj.