mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2025-08-03 17:44:49 +02:00
fix: Move spam to mailbox associated to the \Junk
special-use attribute (#3925)
Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com>
This commit is contained in:
parent
e21e5e0490
commit
3649699197
7 changed files with 43 additions and 11 deletions
21
test/config/junk-mailbox/user-patches.sh
Executable file
21
test/config/junk-mailbox/user-patches.sh
Executable file
|
@ -0,0 +1,21 @@
|
|||
#!/bin/bash
|
||||
##
|
||||
# This user script will be executed between configuration and starting daemons
|
||||
# To enable it you must save it in your config directory as "user-patches.sh"
|
||||
##
|
||||
|
||||
echo "[user-patches.sh] Adjusting 'Junk' mailbox name to verify delivery to Junk mailbox based on special-use flag instead of mailbox's name"
|
||||
|
||||
sed -i -e 's/mailbox Junk/mailbox Spam/' /etc/dovecot/conf.d/15-mailboxes.conf
|
||||
|
||||
### Before / After ###
|
||||
|
||||
# mailbox Junk {
|
||||
# auto = subscribe
|
||||
# special_use = \Junk
|
||||
# }
|
||||
|
||||
# mailbox Spam {
|
||||
# auto = subscribe
|
||||
# special_use = \Junk
|
||||
# }
|
|
@ -244,7 +244,7 @@ function teardown_file() { _default_teardown ; }
|
|||
_service_log_should_contain_string 'rspamd' 'add header "Gtube pattern"'
|
||||
|
||||
_print_mail_log_for_msgid 'rspamd-test-email-header'
|
||||
assert_output --partial "fileinto action: stored mail into mailbox 'Junk'"
|
||||
assert_output --partial "fileinto action: stored mail into mailbox [SPECIAL-USE \\Junk]"
|
||||
|
||||
_count_files_in_directory_in_container /var/mail/localhost.localdomain/user1/new/ 2
|
||||
_count_files_in_directory_in_container /var/mail/localhost.localdomain/user1/.Junk/new/ 1
|
||||
|
|
|
@ -49,9 +49,11 @@ function teardown() { _default_teardown ; }
|
|||
_should_receive_spam_at '/var/mail/localhost.localdomain/user1/new/'
|
||||
}
|
||||
|
||||
@test "(enabled + MOVE_SPAM_TO_JUNK=1) should deliver spam message into Junk folder" {
|
||||
@test "(enabled + MOVE_SPAM_TO_JUNK=1) should deliver spam message into Junk mailbox" {
|
||||
export CONTAINER_NAME=${CONTAINER3_NAME}
|
||||
|
||||
_init_with_defaults
|
||||
|
||||
local CUSTOM_SETUP_ARGUMENTS=(
|
||||
--env ENABLE_AMAVIS=1
|
||||
--env ENABLE_SPAMASSASSIN=1
|
||||
|
@ -60,14 +62,17 @@ function teardown() { _default_teardown ; }
|
|||
--env MOVE_SPAM_TO_JUNK=1
|
||||
--env PERMIT_DOCKER=container
|
||||
)
|
||||
_init_with_defaults
|
||||
|
||||
# Adjust 'Junk' mailbox name to verify delivery to Junk mailbox based on special-use flag instead of mailbox's name
|
||||
mv "${TEST_TMP_CONFIG}/junk-mailbox/user-patches.sh" "${TEST_TMP_CONFIG}/"
|
||||
|
||||
_common_container_setup 'CUSTOM_SETUP_ARGUMENTS'
|
||||
|
||||
_should_send_spam_message
|
||||
_should_be_received_by_amavis 'Passed SPAM {RelayedTaggedInbound,Quarantined}'
|
||||
|
||||
# Should move delivered spam to Junk folder
|
||||
_should_receive_spam_at '/var/mail/localhost.localdomain/user1/.Junk/new/'
|
||||
# Should move delivered spam to the Junk mailbox (adjusted to be located at '.Spam/')
|
||||
_should_receive_spam_at '/var/mail/localhost.localdomain/user1/.Spam/new/'
|
||||
}
|
||||
|
||||
# NOTE: Same as test for `CONTAINER3_NAME`, only differing by ENV `MARK_SPAM_AS_READ=1` + `_should_receive_spam_at` location
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue