# HG changeset patch # User Matthew Wild # Date 1735566870 0 # Node ID 4b1a4be434876af8a38c6d22b0d4ba76254cfa3f # Parent a54b94a3e9949c15721963b06d36830a708f2c2d mod_anti_spam: Improve error bounce text with actionable info diff -r a54b94a3e994 -r 4b1a4be43487 mod_anti_spam/mod_anti_spam.lua --- a/mod_anti_spam/mod_anti_spam.lua Mon Dec 30 13:52:59 2024 +0000 +++ b/mod_anti_spam/mod_anti_spam.lua Mon Dec 30 13:54:30 2024 +0000 @@ -20,6 +20,11 @@ local hosts = prosody.hosts; +local reason_messages = { + default = "Rejected as spam"; + ["known-spam-source"] = "Rejected as spam. Your server is listed as a known source of spam. Please contact your server operator."; +}; + function block_spam(event, reason, action) event.spam_reason = reason; event.spam_action = action; @@ -32,7 +37,7 @@ if action == "bounce" then module:log("debug", "Bouncing likely spam %s from %s (%s)", event.stanza.name, event.stanza.attr.from, reason); - event.origin.send(st.error_reply("cancel", "policy-violation", "Rejected as spam")); + event.origin.send(st.error_reply("cancel", "policy-violation", reason_messages[reason] or reason_messages.default)); else module:log("debug", "Discarding likely spam %s from %s (%s)", event.stanza.name, event.stanza.attr.from, reason); end