On Thu, May 13, 2004 at 10:50:41AM -0500, Kenneth Andresen said:
> Hello all,
> 
> I am in a position where I can't add milter to sendmail due to having
> Redhat Enterprise ES2.1 server and thus loose support on sendmail by
> recompiling it...
> 
> I do believe however that it should be possible to avoid a milter by
> means of a procmail receipt. 
> 
> Anyone who have a tried and tested receipt, or have suggestions for how
> to accomplish this? 
> 
> 
> In advance thanks!

Somebody also suggested using an external program, such as this, to
handle error codes in a way procmail and maildrop understands.

#!/usr/bin/perl
# Filters mail through clamav. Intented to be used as a maildrop xfilter,
# So it takes care to exit 0 on success, and nonzero on error. Adds a
# X-Virii-Status header.
# Contributed by Joey Hess <[EMAIL PROTECTED]> to be used with procmail
use strict;
use warnings;

$/=undef;
my $msg=<>;

open (CLAM, "| clamscan --mbox --quiet --unzip -")
        || die "cannot run clamscan: $!";
# The --mbox support is flakey and requires a From header as in a real
# mbox.
print CLAM "From foo\n";
print CLAM $msg;
close CLAM;
# Returns status of 1 for virii.
my $status= ($? >> 8 == 1) ? "yes" : "no";
#print STDERR "status: ".($? >> 8)." $!\n";

open (FORMAIL, "|formail -i 'X-Virii-Status: $status'")
        || die "cannot run formail: $!!";
print FORMAIL $msg
        || die "cannot write to formail: $!";
close FORMAIL
        || die "formail failed: $!";

exit 0;


-- 
 --------------------------------------------------------------------------
|  Stephen Gran                  | The truth of a proposition has nothing  |
|  [EMAIL PROTECTED]             | to do with its credibility.  And vice   |
|  http://www.lobefin.net/~steve | versa.                                  |
 --------------------------------------------------------------------------

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to