1 |
commit 48d1a5b9febc96d2d3c4110500759e36fb4eabb6 |
2 |
Author: Jonathan Martens <jonathan@snetram.nl> |
3 |
Date: Wed Nov 4 11:10:38 2009 +0100 |
4 |
|
5 |
Custom spam tag subject munging in spamassasin plugin |
6 |
|
7 |
Hi all! |
8 |
|
9 |
I have written a patch to allow the spamassasin plugin to have a custom |
10 |
spam tag read in from a configuration file as opposed to the default *** |
11 |
SPAM *** that is hard coded. |
12 |
|
13 |
When the configuration file (spamsubjectprefix) is not defined or empty |
14 |
the default value still applies, if it is provided the value from the |
15 |
configuration file is used. |
16 |
|
17 |
Any change this can be considered for implementation as we would really |
18 |
like to have it for SME Server. |
19 |
|
20 |
Kind regards, |
21 |
|
22 |
Jonathan |
23 |
|
24 |
Signed-off-by: Robert <rspier@pobox.com> |
25 |
|
26 |
diff --git a/plugins/spamassassin b/plugins/spamassassin |
27 |
index 1a1b4b1..be3a67b 100644 |
28 |
--- a/plugins/spamassassin |
29 |
+++ b/plugins/spamassassin |
30 |
@@ -41,7 +41,8 @@ The default is to never reject mail based on the SpamAssassin score. |
31 |
=item munge_subject_threshold [threshold] |
32 |
|
33 |
Set the threshold where the plugin will prefix the subject with |
34 |
-'***SPAM***'. A modified subject is easier to filter on than the |
35 |
+'***SPAM***' or the value defined in the spamsubjectprefix |
36 |
+configuration file. A modified subject is easier to filter on than the |
37 |
other headers for many people with not so clever mail clients. You |
38 |
might want to make another plugin that does this on a per user basis. |
39 |
|
40 |
@@ -236,8 +237,9 @@ sub check_spam_munge_subject { |
41 |
|
42 |
return DECLINED unless $score >= $self->{_args}->{munge_subject_threshold}; |
43 |
|
44 |
+ my $subject_prefix = $self->qp->config('spamsubjectprefix') || '*** SPAM ***'; |
45 |
my $subject = $transaction->header->get('Subject') || ''; |
46 |
- $transaction->header->replace('Subject', "***SPAM*** $subject"); |
47 |
+ $transaction->header->replace('Subject', "$subject_prefix $subject"); |
48 |
|
49 |
return DECLINED; |
50 |
} |