From: Andrew Lewis Date: Mon, 13 Feb 2017 12:41:16 +0000 (+0200) Subject: [Minor] Yield matched title in FROM_NAME_HAS_TITLE rule X-Git-Tag: 1.5.0~119^2~2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d4cdf447b822835ee16947f88d88b9b7231d7995;p=rspamd.git [Minor] Yield matched title in FROM_NAME_HAS_TITLE rule --- 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