mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2025-08-04 18:15:29 +02:00
Rspamd: adjust learning of ham (#3334)
* adjust learning of ham See #3333 When moving a mail from the Junk folder to the Trash folder, the mail previously classified as ham due to the wildcard match of `*`. Because the syntax does not allow for negation, we can only change the behavior in a way that mails are learned as ham when they are moved into `INBOX` from `Junk`. This is reasonable though. * adjust tests accordingly * adjust docs accordingly
This commit is contained in:
parent
78b7f0cbea
commit
9fd00bd6ad
5 changed files with 34 additions and 30 deletions
|
@ -237,14 +237,8 @@ function teardown_file() { _default_teardown ; }
|
|||
_run_in_container grep -F 'sieve_pipe_bin_dir = /usr/lib/dovecot/sieve-pipe' "${SIEVE_CONFIG_FILE}"
|
||||
assert_success
|
||||
|
||||
# Move an email to the "Junk" folder from "INBOX"; the first email we
|
||||
# sent should pass fine, hence we can now move it
|
||||
_send_email 'nc_templates/rspamd_imap_move_to_junk' '0.0.0.0 143'
|
||||
sleep 1 # wait for the transaction to finish
|
||||
|
||||
local MOVE_TO_JUNK_LINES=(
|
||||
local LEARN_SPAM_LINES=(
|
||||
'imapsieve: mailbox Junk: MOVE event'
|
||||
'imapsieve: Matched static mailbox rule [1]'
|
||||
"sieve: file storage: script: Opened script \`learn-spam'"
|
||||
'sieve: file storage: Using Sieve script path: /usr/lib/dovecot/sieve-pipe/learn-spam.sieve'
|
||||
"sieve: Executing script from \`/usr/lib/dovecot/sieve-pipe/learn-spam.svbin'"
|
||||
|
@ -254,20 +248,7 @@ function teardown_file() { _default_teardown ; }
|
|||
"left message in mailbox 'Junk'"
|
||||
)
|
||||
|
||||
_run_in_container cat /var/log/mail/mail.log
|
||||
assert_success
|
||||
for LINE in "${MOVE_TO_JUNK_LINES[@]}"
|
||||
do
|
||||
assert_output --partial "${LINE}"
|
||||
done
|
||||
|
||||
# Move an email to the "INBOX" folder from "Junk"; there should be two mails
|
||||
# in the "Junk" folder
|
||||
_send_email 'nc_templates/rspamd_imap_move_to_inbox' '0.0.0.0 143'
|
||||
sleep 1 # wait for the transaction to finish
|
||||
|
||||
local MOVE_TO_JUNK_LINES=(
|
||||
'imapsieve: Matched static mailbox rule [2]'
|
||||
local LEARN_HAM_LINES=(
|
||||
"sieve: file storage: script: Opened script \`learn-ham'"
|
||||
'sieve: file storage: Using Sieve script path: /usr/lib/dovecot/sieve-pipe/learn-ham.sieve'
|
||||
"sieve: Executing script from \`/usr/lib/dovecot/sieve-pipe/learn-ham.svbin'"
|
||||
|
@ -275,9 +256,30 @@ function teardown_file() { _default_teardown ; }
|
|||
"left message in mailbox 'INBOX'"
|
||||
)
|
||||
|
||||
# Move an email to the "Junk" folder from "INBOX"; the first email we
|
||||
# sent should pass fine, hence we can now move it.
|
||||
_send_email 'nc_templates/rspamd_imap_move_to_junk' '0.0.0.0 143'
|
||||
sleep 1 # wait for the transaction to finish
|
||||
|
||||
_run_in_container cat /var/log/mail/mail.log
|
||||
assert_success
|
||||
for LINE in "${MOVE_TO_JUNK_LINES[@]}"
|
||||
assert_output --partial 'imapsieve: Matched static mailbox rule [1]'
|
||||
refute_output --partial 'imapsieve: Matched static mailbox rule [2]'
|
||||
for LINE in "${LEARN_SPAM_LINES[@]}"
|
||||
do
|
||||
assert_output --partial "${LINE}"
|
||||
done
|
||||
|
||||
# Move an email to the "INBOX" folder from "Junk"; there should be two mails
|
||||
# in the "Junk" folder, since the second email we sent during setup should
|
||||
# have landed in the Junk folder already.
|
||||
_send_email 'nc_templates/rspamd_imap_move_to_inbox' '0.0.0.0 143'
|
||||
sleep 1 # wait for the transaction to finish
|
||||
|
||||
_run_in_container cat /var/log/mail/mail.log
|
||||
assert_success
|
||||
assert_output --partial 'imapsieve: Matched static mailbox rule [2]'
|
||||
for LINE in "${LEARN_HAM_LINES[@]}"
|
||||
do
|
||||
assert_output --partial "${LINE}"
|
||||
done
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue