Finally solve the problem with the "altermime_args_defang" :
------------------------------------------------------------------------------------------------------------------------
sub dynamic_altermime_disclaimer {
my($self,$conn,$msginfo) = @_;
our($fh, $filename) =
File::Temp::tempfile("fileXXXXX", SUFFIX => '.txt',
DIR => '/tmp/');
$fh->print(<<"EOD") or die "Error writing to $filename: $!";
$msginfo->{'hdr_edits'}->{'addrcvd'}->[3]
EOD
$fh->close or die "Can't close $filename: $!";
our($fh, $filenamehtml) =
File::Temp::tempfile("fileXXXXX", SUFFIX => '.html',
DIR => '/tmp/');
$fh->print(<<"EOD") or die "Error writing to $filenamehtml: $!";
<a>$msginfo->{'hdr_edits'}->{'addrcvd'}->[3]</a>
EOD
$fh->close or die "Can't close $filenamehtml: $!";
$policy_bank{'DYNAMIC_DISCLAIMER'} = {
log_level => 5,
altermime_args_disclaimer => ['--verbose', "--disclaimer=$filename",
"--disclaimer-html=$filenamehtml" ],
altermime_args_defang => ['--verbose', "--disclaimer=$filename",
"--disclaimer-html=$filenamehtml" ],
allow_disclaimers => 1,
defang_maps_by_ccat => { CC_CATCHALL, [ 'altermime' ] },
};
Amavis::load_policy_bank('DYNAMIC_DISCLAIMER');
}
------------------------------------------------------------------------------------------------------------------------
However, I've got some emails without footer, with these logs :
------------------------------------------------------------------------------------------------------------------------
Apr 10 09:48:32 axemail1 amavis[12603]: (12603-01) program
/usr/bin/altermime said: Attempting to add disclaimer\nWARNING: Could
not insert HTML disclaimer into email\nDone.\n
------------------------------------------------------------------------------------------------------------------------
Any ideas ?
Thanks.
Marc
Marc Sisto a écrit :
> Hi,
>
> I'm trying to insert a "X-DSPAM-Signature" in emails with the following
> config. The tempfiles are well created with the "X-DSPAM-Signature" I
> want, then deleted, but the policy_bank seems to fail while I got
> nothing in processed emails. Any ideas what's my problem ?
>
> ------------------------------------------------------------------------------------------------------------------------
> use strict;
> package Amavis::Custom;
> use File::Temp ();
>
> BEGIN {
> import Amavis::Conf qw(:platform :confvars c cr ca $myhostname);
> import Amavis::Util qw(do_log untaint min max);
> }
>
> sub new {
> my($class,$conn,$msginfo) = @_;
> my($self) = bless {}, $class; $self;
> }
>
> sub dynamic_altermime_disclaimer {
>
> my($self,$conn,$msginfo) = @_;
>
> my($fh, $filename) =
> File::Temp::tempfile("fileXXXXX", SUFFIX => '.txt',
> DIR => '/tmp/');
> $fh->print(<<"EOD") or die "Error writing to $filename: $!";
> $msginfo->{'hdr_edits'}->{'addrcvd'}->[3]
> EOD
> $fh->close or die "Can't close $filename: $!";
>
> $policy_bank{'DYNAMIC_DISCLAIMER'} = {
> allow_disclaimers => 1,
> altermime_args_disclaimer => ['--verbose', "--disclaimer=$filename"],
> };
> Amavis::load_policy_bank('DYNAMIC_DISCLAIMER');
> if (defined $filename) {
> unlink($filename) or die "Can't remove $filename: $!";
> }
> }
>
> 1; # ensure a defined return
> ------------------------------------------------------------------------------------------------------------------------
>
> Marc
>
> ------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> AMaViS-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/amavis-user
> AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3
> AMaViS-HowTos:http://www.amavis.org/howto/
>
>
>
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
AMaViS-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/amavis-user
AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3
AMaViS-HowTos:http://www.amavis.org/howto/