From d4cdf447b822835ee16947f88d88b9b7231d7995 Mon Sep 17 00:00:00 2001 From: Andrew Lewis Date: Mon, 13 Feb 2017 14:41:16 +0200 Subject: [PATCH] [Minor] Yield matched title in FROM_NAME_HAS_TITLE rule --- rules/misc.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/rules/misc.lua b/rules/misc.lua index 56de79a6b..2685e3826 100644 --- a/rules/misc.lua +++ b/rules/misc.lua @@ -477,8 +477,14 @@ local check_from_id = rspamd_config:register_callback_symbol('CHECK_FROM', 1.0, task:insert_result('FROM_HAS_DN', 1.0) -- Look for Mr/Mrs/Dr titles local n = from[1].name:lower() - if (n:find('^mrs?[%.%s]') or n:find('^dr[%.%s]')) then - task:insert_result('FROM_NAME_HAS_TITLE', 1.0) + local match, match_end + match, match_end = n:find('^mrs?[%.%s]') + if match then + task:insert_result('FROM_NAME_HAS_TITLE', 1.0, n:sub(match, match_end-1)) + end + match, match_end = n:find('^dr[%.%s]') + if match then + task:insert_result('FROM_NAME_HAS_TITLE', 1.0, n:sub(match, match_end-1)) end end if (envfrom and from and envfrom[1] and from[1] and -- 2.39.5