Expanding MultipleQueueDir function

Errol Neal eneal at dfi-intl.com
Tue Jun 13 05:57:50 IST 2006

I'm trying to expand the MultipleQueueDir function to make it a bit more
usable for my environment. I'm almost there, but it seems like something
in the code I've written isn't correct. Now mind you, I'm not a
Programmer so some of it may be terribly wrong. I reused a lot of what's
already in CustomConfig.pm. 

my ($PriorityDomainListFile) =
use FileHandle;

sub InitMultipleQueueDir {
    MailScanner::Log::InfoLog("Initialising list for domains receiving
priority service");
                              #"from %s", $PriorityDomainListFile);
    my $listfile = new FileHandle;

    unless($listfile->open("<$PriorityDomainListFile")) {
        MailScanner::Log::WarnLog("Could not read list of domains for
priority service " .
                                   "from %s", $PriorityDomainListFile);


  my($fh, $line, $PriorityDomainList);
  $line = 0;
  while (<$listfile>) {
      #print STDERR "Line is \"$_\"\n";
      s/#.*$//; # Strip comments
      s/\S*:\S*//g; # Strip any words with ":" in them
      s/^\s+//g; # Strip leading whitespace
      s/^(\S+)\s.*$/$1/; # Use only the 1st word
      s/^\*\@//; # Strip any leading "*@" they might have put in
      #print STDERR "Line is \"$_\"\n";
      next if /^$/; # Strip blank lines
      $PriorityDomainList->{$listfile}{lc($_)} = 1; # Store the domains
    MailScanner::Log::InfoLog("Read %d domains from %s", $line,


sub EndMultipleQueueDir {
    MailScanner::Log::InfoLog("Shutting down priority domain list");


sub MultipleQueueDir {
  my($message, $PriorityDomainList) = @_;

  #return 0 unless $message; # Sanity check the input

  my(@todomain, $todomain, $isspam);
  @todomain   = @{$message->{todomain}};
  $todomain   = $todomain[0];
  $isspam     = $message->{isspam};

  return '/var/spool/mqueue' unless $message;
  return '/var/spool/mqueue.priority' if
  return '/var/spool/mqueue.spam' if $message->{$isspam};

  # It is not in the list
  return '/var/spool/mqueue';

Hopefully, you can get the picture of what I'm trying to do. Domains are
stored in the prioritylist.conf. 
>From what I can tell, it's not getting beyond opening the file and
reading it. 
Can someone help me get this working right?


Errol Neal

More information about the MailScanner mailing list