[Mimedefang] RE: Don't call spamassassin for outbound e-mails

Dirk the Daring dirk at psicorps.org
Sat Dec 10 13:34:38 EST 2005


On Sat, 10 Dec 2005 mimedefang-request at lists.roaringpenguin.com wrote:

>----------------------------------------------------------------------
>From: "Ana Luiza Moura Weidlich" <ana.weidlich at portoweb.com.br>
>
>I´d like to use SpamAssassin to check just my inbound e-mails. I use SA with
>MIMEDefang and Sendmail.
>How should I do configure mimedefang to don't call SA for outbound e-mails?
>------------------------------

Ana,

	There's no handy "canned" way to do this with stock MIMEDefang,
at least not that I found. I modified mimedefang-filter to check
$RelayAddr against an array of my internal addresses, and then in
filter_end the call to SA is skipped if the host is internal. Here's the
relevant portions of my mimedefang-filter code.

Global variables:

###############################
# Declare an array of IP addresses we consider internal
#   and a flag to use for program flow checks
###############################
@ourhosts=qw( xxx.yyy.zzz.1 xxx.yyy.zzz.2 xxx.yyy.zzz.3 );
$ourhost=0;


In filter_begin:

# Determine if we are dealing with our own hosts
for ( $indexhost=0 ; $indexhost < @ourhosts ; $indexhost++ )
   {
     if ( $RelayAddr eq $ourhosts[$indexhost] )
	{
           # This is our host - set a flag
           $ourhost=1;
	   last;
	}
   }


In filter_end:

# Only bother with SpamAssassin if an E-Mail is *not* originating
#   from inside our network
if ( ! $ourhost )
   {
	# Get size of message
	$totalsize = -s "./INPUTMSG";

	# Call SpamAssassin to perform SPAM checking, but only scan
	#   messages that are smaller than the limit defined above
	if ( $totalsize < $SAScanSizeLimit )
		{
		   # Call SpamAssassin
		   #   hits = E-Mail SPAM score
		   #   req = value of "required_hits" in sa-mimedefang.cf
		   #   names = names of SPAM tests that it failed
		   #   report = SA report
		   my($hits, $req, $names, $report) = spam_assassin_check();
		}
   }



More information about the MIMEDefang mailing list