Software /
code /
prosody-modules
Changeset
6126:4b1a4be43487
mod_anti_spam: Improve error bounce text with actionable info
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 30 Dec 2024 13:54:30 +0000 |
parents | 6125:a54b94a3e994 |
children | 6127:559648c7c8d6 |
files | mod_anti_spam/mod_anti_spam.lua |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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