Link to home
Start Free TrialLog in
Avatar of larstr
larstrFlag for Norway

asked on

Postfix script filter

I'm having a debian 4.0 system that is setup as a spam+av+relay server. I have now defined a virtual subdomain that I plan to use as a spam reporting service. I've written a script that will report back to the sending user with given statistics, etc... This works fine from the command line, but it doesn't work from an email as it seems that it lacks one of the parameters.

I've updated my master.cf  (ref: http://www.posluns.com/guides/mastcf.html) like this:
spamreport unix  -       n       n       -       -       pipe
    flags=F  user=nobody
    argv=/usr/bin/perl /usr/local/bin/spamreport.pl ${sender} ${recipient}

I now have a small perl script like this:
#!/usr/bin/perl
my $sender=$ARGV[1];
my $recipient=$ARGV[2];
open(FILE,">/tmp/filtertest.txt") || die("can't open file: $!");
print FILE "sender=$sender recipient=$recipient\n";
close(FILE);

The content of the generated file /tmp/filtertest.txt is showing that only $sender is getting a parameter, but it's not the correct one; it's the recipient's address so I'm suspecting that sender is passed as a blank parameter.

Any help is appreciated!

Lars
ASKER CERTIFIED SOLUTION
Avatar of nedfine
nedfine
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of larstr

ASKER

Thanks..