LookupByDomainList / X-Original-To / CustomConfig.pm

Paul van Brouwershaven paul at vanbrouwershaven.com
Thu Nov 30 20:13:27 GMT 2006


I configured multiple MailScanner servers as frontend in a cluster of client mailservers. The
MailScanner scans the e-mail and forward the users e-mail to the client server on a virual domain
aliassing list in postfix.

Mail to: admin at domain1.com
Delivered to: user123 at server23.network.com

The problem is that mailscanner looks for black and whitelists in the file "server23.network.com"
and not in the domain "domain1.com"

I want to change this function so MailScanner would also look in the X-Original-To header.

Who can help me to rewrite this function? (tell me how to access $message->{X-Original-To} and

sub LookupByDomainList {
   my($message, $BlackWhite) = @_;

   return 0 unless $message; # Sanity check the input

   # Find the "from" address and the first "to" address
   my($from, $fromdomain, @todomain, $todomain, @to, $to, $ip);
   $from       = $message->{from};
   $fromdomain = $message->{fromdomain};
   @todomain   = @{$message->{todomain}};
   $todomain   = $todomain[0];
   @to         = @{$message->{to}};
   $to         = $to[0];
   $ip         = $message->{clientip};

   # It is in the list if either the exact address is listed,
   # or the domain is listed
   return 1 if $BlackWhite->{$to}{$from};
   return 1 if $BlackWhite->{$to}{$fromdomain};
   return 1 if $BlackWhite->{$to}{$ip};
   return 1 if $BlackWhite->{$todomain}{$from};
   return 1 if $BlackWhite->{$todomain}{$fromdomain};
   return 1 if $BlackWhite->{$todomain}{$ip};
   return 1 if $BlackWhite->{'default'}{$from};
   return 1 if $BlackWhite->{'default'}{$fromdomain};
   return 1 if $BlackWhite->{'default'}{$ip};

   # It is not in the list
   return 0;

More information about the MailScanner mailing list