Honor per-user spam settings, fixes #21

master
Pierre Jaury 8 years ago
parent 2a3f62fc65
commit daf8c4bad3

@ -1,5 +1,19 @@
connect = /data/freeposte.db
map {
pattern = priv/spam_enabled
table = user
username_field = email
value_field = spam_enabled
}
map {
pattern = priv/spam_threshold
table = user
username_field = email
value_field = spam_threshold
}
map {
pattern = priv/reply_enabled
table = user

@ -1,6 +1,12 @@
require ["fileinto", "envelope", "mailbox", "imap4flags"];
require ["variables", "fileinto", "envelope", "mailbox", "imap4flags", "regex", "relational", "comparator-i;ascii-numeric", "vnd.dovecot.extdata"];
if header :contains "X-Spam" "YES" {
setflag "\\seen";
fileinto :create "Junk";
if string :is "${extdata.spam_enabled}" "1" {
if header :matches "X-Spam-Status" "* score=*" {
if string :value "ge" :comparator "i;ascii-numeric" "${2}" "${extdata.spam_threshold}" {
setflag "\\seen";
fileinto :create "Junk";
stop;
}
}
}

@ -59,6 +59,8 @@ spamd {
rspamd_metric = "default";
# Do not reject, add header
spamd_never_reject = yes;
# Add extended spam headers
extended_spam_headers = yes;
};
redis {

Loading…
Cancel
Save