Adding Envelope Headers?

Derek Winkler dwinkler at ALGORITHMICS.COM
Fri Feb 13 15:08:52 GMT 2004


> -----Original Message-----
> From: MailScanner mailing list [mailto:MAILSCANNER at JISCMAIL.AC.UK]On
> Behalf Of Kai Schaetzl
> Sent: Friday, February 13, 2004 9:00 AM
> To: MAILSCANNER at JISCMAIL.AC.UK
> Subject: Re: Adding Envelope Headers?
> 
> 
> Derek Winkler wrote on         Thu, 12 Feb 2004 16:51:29 -0500:
> 
> > I added the from to X-Algo-MailScanner-Information with a 
> custom function.
>

Make this change to your MailScanner.conf

Information Header Value = &AddEnvelopeAddress

Then add these functions to CustomConfig.pm:

#
# Add the envelope address to the "Information Header Value" config
parameter.
#
sub InitAddEnvelopeAddress {
  # No initialisation needs doing here at all.
  MailScanner::Log::InfoLog("Initialising AddEnvelopeAddress");
}

sub EndAddEnvelopeAddress {
  # No shutdown code needed here at all.
  MailScanner::Log::InfoLog("Ending AddEnvelopeAddress");
}

sub AddEnvelopeAddress {
  my($message) = @_;

  my $from = $message->{from};

  if ($from !~  m/^[\w-]+(?:\.[\w-]+)*@(?:[\w-]+\.)+[a-zA-Z]{2,7}$/) {
    $from="unknown";
  }

  return "Please contact Whoever for more information ($from)";

}

Envelope from will now appear in the header defined by "Information Header"
in MailScanner.conf.

> Sorry, I fear I don't understand what you mean or maybe I 
> just fear I won't
> be able to do that. But, wouldn't it be much better to have 
> it added like
> 
> X-Envelope-From:
> X-Envelope-To:
> 
> instead of being buried in some other information?
> 
> > That's your MTA's job.
> >
> 
> Almost overlooked that one. I think that's strictly a 
> point-of-view thing.
> Why should it be natural for the MTA to do? Anyway, I 
> searched around how
> sendmail could do this and it simply doesn't. I found only 
> these clumsy
> procmail solutions:
> http://www.sendmail.org/faq/section3.html#3.29
> http://www.polbox.com/a/anfi/sendmail/sharedmailbox.html
> and still no X-Envelope-From.
> 
> We are currently using a milter which happily adds both 
> headers by default
> and I found that they are very useful for everything 
> concerning anti-spam
> measures, adding to access.db etc. but also for whitelisting. 
> Actually, I
> was quite surprised when first checking out Mailscanner that 
> it doesn't add
> these headers and wonder why it doesn't. Mailscanner seems to 
> be the perfect
> place to do it. Obviously, sendmail doesn't do, that's why 
> several milters
> add them (f.i. amavis-new does it, but why add another milter 
> to the chain
> if I don't need it for other things?).
> 
> Kai
> 
> --
> 
> Kai Schätzl, Berlin, Germany
> Get your web at Conactive Internet Services: http://www.conactive.com
> IE-Center: http://ie5.de & http://msie.winware.org
> 




More information about the MailScanner mailing list