Attila,

> I've always been frustrated about amavisd not setting the
> X-Spam-Languages header (while it -by default- loads the TextCat
> SpamAssassin plugin, so the information is there and it take some CPU
> time to figure it out), but now I actually need it, so made the
> following patch to the latest (from FreeBSD ports) amavisd.
>
> By default amavisd now includes the X-Spam-Languages header. If backward
> compatibility is required, X-Spam-Languages should not be added in the
> allowed_added_header_fields hash, so this produces the current output
> with the possibility to include the header if needed.
>
> Mark, do you think it's OK to include it in the mainline?

Well, you need X-Spam-Languages, somebody else needs X-Relay-Countries,
still others might need X-Spam-ASN, AWL information, etc.
So where should it stop?

I think the custom hooks (i.e. code supplied in amavisd.conf) provides
a sufficient and not too complicated mechanism to cater for such needs:

Assuming amavisd-new-2.5.4 (or 2.6.0-*), place the following
into amavisd.conf:
  include_config_files('/etc/amavisd-custom.conf');


The /etc/amavisd-custom.conf could then look like:


package Amavis::Custom;
use strict;

sub new {
  my($class,$conn,$msginfo) = @_;
  bless {}, $class;
}

sub before_send {
  my($self,$conn,$msginfo) = @_;
  my($all_local) = !grep { !$_->recip_is_local } @{$msginfo->per_recip_data};
  if ($all_local) {
    my($hdr_edits) = $msginfo->header_edits;
    my($rly_country) = $msginfo->supplementary_info('RELAYCOUNTRY');
    $hdr_edits->add_header('X-Relay-Countries', $rly_country)
      if defined $rly_country && $rly_country ne '';
    my($languages) = $msginfo->supplementary_info('LANGUAGES');
    $hdr_edits->add_header('X-Spam-Languages', $languages)
      if defined $languages && $languages ne '';
  }
};

1;  # insure a defined return



Sorry for a late  reply.
  Mark

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
AMaViS-user mailing list
AMaViS-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amavis-user
AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3
AMaViS-HowTos:http://www.amavis.org/howto/

Reply via email to