Hello,
could you add an header in amavisd to identify the Amavis Category?
This info could be of help to classify emails through external filters
(sieve, or IMAP client filters...).
I leave the attached patch: it adds the "X-Amavis-Category" header based
on ccat_display_names if the "$header_category = 1" is found on
amavisd.conf.
It works for me, but I don't know Amavis deeply, so you could improve
the mechanism if you like.
In amavisd.conf remember to add the following line:
$header_category = 1; # Add an header with Amavis category
Thank you very much to consider this.
Warm Regards
Marco
--- amavisd 2019-03-26 12:24:25.463824723 +0100
+++ amavisd-orig 2018-10-18 15:03:46.000000000 +0200
@@ -313,7 +313,7 @@
$first_infected_stops_scan $virus_scanners_failure_is_fatal
$sa_spam_level_char $sa_mail_body_size_limit
$penpals_bonus_score $penpals_halflife $bounce_killer_score
- $reputation_factor $header_category
+ $reputation_factor
$undecipherable_subject_tag $localpart_is_case_sensitive
$recipient_delimiter $replace_existing_extension
$hdr_encoding $bdy_encoding $hdr_encoding_qb
@@ -1100,8 +1100,6 @@
$undecipherable_subject_tag = '***UNCHECKED*** ';
- $header_category = 0;
-
# NOTE: all entries can accept mail_body_size_limit and score_factor options
@spam_scanners = (
['SpamAssassin', 'Amavis::SpamControl::SpamAssassin' ],
@@ -1286,7 +1284,7 @@
$allowed_added_header_fields{lc($_)} = 1 for qw(
Received DKIM-Signature Authentication-Results VBR-Info
X-Quarantine-ID X-Amavis-Alert X-Amavis-Hold X-Amavis-Modified
- X-Amavis-PenPals X-Amavis-OS-Fingerprint X-Amavis-PolicyBank
X-Amavis-Category
+ X-Amavis-PenPals X-Amavis-OS-Fingerprint X-Amavis-PolicyBank
X-Spam-Status X-Spam-Level X-Spam-Flag X-Spam-Score
X-Spam-Report X-Spam-Checker-Version X-Spam-Tests
X-CRM114-Status X-CRM114-CacheID X-CRM114-Notice X-CRM114-Action
@@ -16058,7 +16056,6 @@
do_log(-1, "signal: %s", join(', ',keys %got_signals)) if %got_signals;
undef $MSGINFO; # release global reference
($smtp_resp, $exit_code, $preserve_evidence);
-
} # end check_mail
# ROT13 obfuscation (Caesar cipher)
@@ -16807,7 +16804,6 @@
my $first = 1; my $cluster_key; my $cluster_full_spam_status;
my $use_our_hdrs = cr('prefer_our_added_header_fields');
my $allowed_hdrs = cr('allowed_added_header_fields');
- my $header_category = c('header_category');
my $x_header_tag = c('X_HEADER_TAG');
my $adding_x_header_tag =
$x_header_tag =~ /^[!-9;-\176]+\z/ && c('X_HEADER_LINE') ne '' &&
@@ -17189,11 +17185,6 @@
}
}
}
-
- if ( $header_category ) {
- $hdr_edits->add_header('X-Amavis-Category',
$msginfo->setting_by_contents_category(\%ccat_display_names) );
- }
-
my $done_all;
if (@recip_cluster == $per_recip_data_len) {
do_log(5,"headers CLUSTERING: done all %d recips in one go",