I am trying to call an external program using xfilter. The external program
parses the email message, extracting some text and moving files based on the
extracted text. However, I cannot be sure that it is actually calling the
script. Here is my mailfilter file:
if ( /^From:.*avad...@telescope.shreve.net/ )
{
xfilter "/usr/local/bin/admin/rav/move_virus"
}
to "./Maildir/"
I get the following error in /var/log/qmail/current when I send a message to
this mailbox from avad...@telescope.shreve.net:
deferral:
maildrop:_error_writing_to_filter.//usr/bin/maildrop:_Unable_to_filter_message./
Here is the scipt:
#!/usr/bin/perl
$ENV{PATH}="/bin:/usr/bin:/usr/local/bin:/usr/local/bin/admin";
$|=1;
$file="/home/cust/s/t/starky/response";
open(F,$file) || die("Could not open $file!");
$j = 0;
while($j < @QUAR) {
open(MESS, "input-pipe-command |"); # Open file
@MESSAGE=<MESS>; # Load each line
into array
close(MESS);
# Check for the line that contains the RAV message ID
$f = 0;
while($f < @MESSAGE) {
$smpart = substr(@MESSAGE[$f],0,4);
$lgpart = substr(@MESSAGE[$f],0,52);
if($smpart eq "sent") {
$whole = substr(@MESSAGE[$f],0);
@parts = split/ /,$whole;
$em = @parts[4];
@half = split/@/,$em;
$username = @half[0];
print F "$whole\n";
print F "@parts\n";
print F "$em\n";
print F "@half\n";
print F "$username\n";
}
if($lgpart eq "The infected file was saved to quarantine with name:")
{
$rest = substr(@MESSAGE[$f],54);
print F "RAV ID: $rest\n";
}
$f++;
}
$j++;
}
exit;
I added the exitl at the end to be sure it exits with exit 0. Am I doing this
right? So far, this could be a maildrop issue or a perl issue. However, I
canot determine which.
Any help is appreciated.