Advertisement

07.02.2008 at 12:51AM PDT, ID: 23532740
[x]
Attachment Details

Postfix script filter

Asked by larstr in Simple Mail Transfer Protocol (SMTP), Perl Programming Language, Debian Linux

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!

LarsStart Free Trial
[+][-]07.02.2008 at 01:23AM PDT, ID: 21914370

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Simple Mail Transfer Protocol (SMTP), Perl Programming Language, Debian Linux
Sign Up Now!
Solution Provided By: nedfine
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628