diff --git a/CHANGELOG.md b/CHANGELOG.md
index df9c6987..0ade3c9b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -20,7 +20,7 @@ All notable changes to this project will be documented in this file. The format
### Updates
- **Tests**:
- - Refactored mail sending ([#3747](https://github.com/docker-mailserver/docker-mailserver/pull/3747)):
+ - Refactored mail sending ([#3747](https://github.com/docker-mailserver/docker-mailserver/pull/3747) & [#3772](https://github.com/docker-mailserver/docker-mailserver/pull/3772)):
- This change is a follow-up to [#3732](https://github.com/docker-mailserver/docker-mailserver/pull/3732) from DMS v13.2.
- `swaks` version is now the latest from Github releases instead of the Debian package.
- `_nc_wrapper`, `_send_mail` and related helpers expect the `.txt` filepath extension again.
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index 05a4e6e4..53254c78 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -321,46 +321,10 @@ Thanks goes to these wonderful people ✨
-
-
+
+
- egavard
-
- |
-
-
-
-
- mathuin
-
- |
-
-
-
-
- dashohoxha
-
- |
-
-
-
-
- jamebus
-
- |
-
-
-
-
-
- lukecyca
-
- |
-
-
-
-
- okainov
+ kiliant
|
@@ -371,53 +335,68 @@ Thanks goes to these wonderful people ✨
|
-
-
+
+
- kiliant
+ okainov
|
-
-
+
+
- m-schmoock
-
- |
-
-
-
-
- mjung
+ lukecyca
|
-
-
+
+
- VanVan
+ jsonn
|
-
-
+
+
- andreasgerstmayr
+ jamebus
|
-
-
+
+
- davidszp
+ dashohoxha
|
-
-
+
+
- kamuri
+ mathuin
+
+ |
+
+
+
+
+ egavard
+
+ |
+
+
+
+
+ weo
+
+ |
+
+
+
+
+
+ Zehir
|
@@ -428,18 +407,46 @@ Thanks goes to these wonderful people ✨
|
-
-
+
+
- Zehir
+ kamuri
+
+ |
+
+
+
+
+ davidszp
+
+ |
+
+
+
+
+ andreasgerstmayr
+
+ |
+
+
+
+
+ VanVan
|
-
-
+
+
- weo
+ mjung
+
+ |
+
+
+
+
+ m-schmoock
|
@@ -469,15 +476,15 @@ Thanks goes to these wonderful people ✨
Starbix
- |
+
+
citec
- |
-
+
@@ -492,13 +499,6 @@ Thanks goes to these wonderful people ✨
analogue
|
-
-
-
-
- MakerMatrix
-
- |
@@ -514,10 +514,10 @@ Thanks goes to these wonderful people ✨
|
-
-
+
+
- jsonn
+ MakerMatrix
|
@@ -642,26 +642,33 @@ Thanks goes to these wonderful people ✨
yogo1212
-
-
-
-
- mpanneck
-
- |
-
willtho89
+ |
+
+
+
+
+
+ mpanneck
+
|
-
-
+
+
- ubenmackin
+ aminvakil
+
+ |
+
+
+
+
+ elbracht
|
@@ -679,17 +686,10 @@ Thanks goes to these wonderful people ✨
|
-
-
+
+
- aminvakil
-
- |
-
-
-
-
- elbracht
+ ubenmackin
|
@@ -780,10 +780,17 @@ Thanks goes to these wonderful people ✨
-
-
+
+
- fl42
+ jamesfryer
+
+ |
+
+
+
+
+ eltociear
|
@@ -801,17 +808,10 @@ Thanks goes to these wonderful people ✨
|
-
-
+
+
- jamesfryer
-
- |
-
-
-
-
- eltociear
+ fl42
|
@@ -944,10 +944,10 @@ Thanks goes to these wonderful people ✨
|
-
-
+
+
- 0xflotus
+ nilshoell
|
@@ -1388,6 +1388,13 @@ Thanks goes to these wonderful people ✨
mchamplain
+
+
+
+
+ 0xflotus
+
+ |
@@ -1415,15 +1422,15 @@ Thanks goes to these wonderful people ✨
damianmoore
- |
+
+
espitall
- |
-
+
@@ -1458,15 +1465,15 @@ Thanks goes to these wonderful people ✨
mazzz1y
- |
+
+
aydodo
- |
-
+
@@ -1501,15 +1508,15 @@ Thanks goes to these wonderful people ✨
ErikEngerd
- |
+
+
huncode
- |
-
+
@@ -1544,15 +1551,15 @@ Thanks goes to these wonderful people ✨
20th
- |
+
+
2b
- |
-
+
@@ -1587,15 +1594,15 @@ Thanks goes to these wonderful people ✨
alexanderneu
- |
+
+
ch3sh1r
- |
-
+
@@ -1630,15 +1637,15 @@ Thanks goes to these wonderful people ✨
MrFreezeex
- |
+
+
arunvc
- |
-
+
@@ -1673,15 +1680,22 @@ Thanks goes to these wonderful people ✨
crash7
- |
+
+
fkefer
- |
-
+
+
+
+
+
+ KCrawley
+
+ |
@@ -1709,7 +1723,8 @@ Thanks goes to these wonderful people ✨
linhandev
- |
+
+
@@ -1723,8 +1738,7 @@ Thanks goes to these wonderful people ✨
LucidityCrash
- |
-
+
@@ -1752,7 +1766,8 @@ Thanks goes to these wonderful people ✨
dragetd
- |
+
+
@@ -1766,8 +1781,7 @@ Thanks goes to these wonderful people ✨
exhuma
- |
-
+
@@ -1795,7 +1809,8 @@ Thanks goes to these wonderful people ✨
mpldr
- |
+
+
@@ -1809,8 +1824,7 @@ Thanks goes to these wonderful people ✨
neuralp
- |
-
+
@@ -1818,13 +1832,6 @@ Thanks goes to these wonderful people ✨
radicand
|
-
-
-
-
- nilshoell
-
- |
@@ -1845,15 +1852,15 @@ Thanks goes to these wonderful people ✨
glandais
- |
+
+
GiovanH
- |
-
+
@@ -1888,15 +1895,15 @@ Thanks goes to these wonderful people ✨
jcalfee
- |
+
+
mivek
- |
-
+
@@ -1931,15 +1938,15 @@ Thanks goes to these wonderful people ✨
jmccl
- |
+
+
jurekbarth
- |
-
+
@@ -1962,10 +1969,10 @@ Thanks goes to these wonderful people ✨
|
-
-
+
+
- KCrawley
+ thechubbypanda
|
diff --git a/docs/content/config/best-practices/dkim_dmarc_spf.md b/docs/content/config/best-practices/dkim_dmarc_spf.md
index da496aa5..ed56504c 100644
--- a/docs/content/config/best-practices/dkim_dmarc_spf.md
+++ b/docs/content/config/best-practices/dkim_dmarc_spf.md
@@ -156,6 +156,13 @@ DKIM is currently supported by either OpenDKIM or Rspamd:
use_esld = true;
check_pubkey = true; # you want to use this in the beginning
+ selector = "mail";
+ # The path location is searched for a DKIM key with these variables:
+ # - `$domain` is sourced from the MIME mail message `From` header
+ # - `$selector` is configured for `mail` (as a default fallback)
+ path = "/tmp/docker-mailserver/dkim/keys/$domain/$selector.private";
+
+ # domain specific configurations can be provided below:
domain {
example.com {
path = "/tmp/docker-mailserver/rspamd/dkim/mail.private";
diff --git a/mailserver.env b/mailserver.env
index 49bc2cca..9b085c9f 100644
--- a/mailserver.env
+++ b/mailserver.env
@@ -401,7 +401,10 @@ SA_TAG2=6.31
SA_KILL=10.0
# add tag to subject if spam detected
-SA_SPAM_SUBJECT='***SPAM*** '
+# The value `undef` opts-out of this feature. The value shown below is the default.
+# NOTE: By default spam is delivered to a junk folder, reducing the value of adding a subject prefix.
+# NOTE: If not using Docker Compose, other CRI may require the single quotes removed.
+#SA_SPAM_SUBJECT='***SPAM*** '
# -----------------------------------------------
# --- Fetchmail Section -------------------------
diff --git a/test/files/emails/amavis/spam.txt b/test/files/emails/amavis/spam.txt
deleted file mode 100644
index e8d26138..00000000
--- a/test/files/emails/amavis/spam.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-From: Docker Mail Server
-To: Existing Local User
-Date: Sat, 22 May 2010 07:43:25 -0400
-Subject: Test Message amavis/spam.txt
-This is a test mail.
-XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X
diff --git a/test/helper/sending.bash b/test/helper/sending.bash
index 529e36aa..e18dc1ac 100644
--- a/test/helper/sending.bash
+++ b/test/helper/sending.bash
@@ -141,14 +141,12 @@ function _send_email_and_get_id() {
# Get rid of ${1} so only the arguments for swaks remain
shift 1
- local QUEUE_ID
# The unique ID Postfix (and other services) use may be different in length
- # on different systems (e.g. amd64 (11) vs aarch64 (10)). Hence, we use a
- # range to safely capture it.
+ # on different systems. Hence, we use a range to safely capture it.
local QUEUE_ID_REGEX='[A-Z0-9]{9,12}'
_wait_for_empty_mail_queue_in_container
- local OUTPUT=$(_send_email "${@}" --header "Message-Id: ${MID}")
+ _send_email "${@}" --header "Message-Id: ${MID}"
_wait_for_empty_mail_queue_in_container
# We store Postfix's queue ID first
@@ -164,3 +162,12 @@ function _send_email_and_get_id() {
run echo "${ID_ENV_VAR_REF}"
assert_line --regexp "^${QUEUE_ID_REGEX}\|${MID}$"
}
+
+# Send a spam e-mail by utilizing GTUBE.
+#
+# Extra arguments given to this function will be supplied by `_send_email_and_get_id` directly.
+function _send_spam() {
+ _send_email_and_get_id MAIL_ID_SPAM "${@}" \
+ --from 'spam@external.tld' \
+ --body 'XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X'
+}
diff --git a/test/tests/parallel/set1/spam_virus/rspamd_full.bats b/test/tests/parallel/set1/spam_virus/rspamd_full.bats
index b83ac353..f66e9231 100644
--- a/test/tests/parallel/set1/spam_virus/rspamd_full.bats
+++ b/test/tests/parallel/set1/spam_virus/rspamd_full.bats
@@ -43,20 +43,18 @@ function setup_file() {
_wait_for_service postfix
_wait_for_smtp_port_in_container
- # ref: https://rspamd.com/doc/gtube_patterns.html
- local GTUBE_SUFFIX='*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X'
-
# We will send 4 emails:
- # 1. The first one should pass just fine
+ # 1. The first one should pass just fine
_send_email_and_get_id MAIL_ID_PASS
- # 2. The second one should be rejected (GTUBE pattern)
- _send_email_and_get_id MAIL_ID_REJECT --expect-rejection --body "XJS${GTUBE_SUFFIX}"
- # 3. The third one should be rejected due to a virus (ClamAV EICAR pattern)
+ # 2. The second one should be rejected (Rspamd-specific GTUBE pattern for rejection)
+ _send_spam --expect-rejection
+ # 3. The third one should be rejected due to a virus (ClamAV EICAR pattern)
# shellcheck disable=SC2016
_send_email_and_get_id MAIL_ID_VIRUS --expect-rejection \
--body 'X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*'
- # 4. The fourth one will receive an added header (GTUBE pattern)
- _send_email_and_get_id MAIL_ID_HEADER --body "YJS${GTUBE_SUFFIX}"
+ # 4. The fourth one will receive an added header (Rspamd-specific GTUBE pattern for adding a spam header)
+ # ref: https://rspamd.com/doc/gtube_patterns.html
+ _send_email_and_get_id MAIL_ID_HEADER --body "YJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X"
_run_in_container cat /var/log/mail.log
assert_success
@@ -122,7 +120,7 @@ function teardown_file() { _default_teardown ; }
_service_log_should_contain_string 'rspamd' 'S \(reject\)'
_service_log_should_contain_string 'rspamd' 'reject "Gtube pattern"'
- _print_mail_log_for_id "${MAIL_ID_REJECT}"
+ _print_mail_log_for_id "${MAIL_ID_SPAM}"
assert_output --partial 'milter-reject'
assert_output --partial '5.7.1 Gtube pattern'
diff --git a/test/tests/parallel/set1/spam_virus/spam_junk_folder.bats b/test/tests/parallel/set1/spam_virus/spam_junk_folder.bats
index 2c3a522d..15ec4fe1 100644
--- a/test/tests/parallel/set1/spam_virus/spam_junk_folder.bats
+++ b/test/tests/parallel/set1/spam_virus/spam_junk_folder.bats
@@ -95,7 +95,7 @@ function teardown() { _default_teardown ; }
function _should_send_spam_message() {
_wait_for_smtp_port_in_container
_wait_for_tcp_port_in_container 10024 # port 10024 is for Amavis
- _send_email --from 'spam@external.tld' --data 'amavis/spam.txt'
+ _send_spam
}
function _should_be_received_by_amavis() {
diff --git a/test/tests/parallel/set3/mta/smtp_delivery.bats b/test/tests/parallel/set3/mta/smtp_delivery.bats
index 329f36b2..e851d94e 100644
--- a/test/tests/parallel/set3/mta/smtp_delivery.bats
+++ b/test/tests/parallel/set3/mta/smtp_delivery.bats
@@ -81,7 +81,7 @@ function setup_file() {
_send_email --to bounce-always@localhost.localdomain
_send_email --to alias2@localhost.localdomain
# Required for 'rejects spam':
- _send_email --from 'spam@external.tld' --data 'amavis/spam.txt'
+ _send_spam
# Required for 'delivers mail to existing account':
_send_email --header 'Subject: Test Message existing-user1'