summaryrefslogtreecommitdiffstats
path: root/rules/misc.lua
diff options
context:
space:
mode:
authorAndrew Lewis <nerf@judo.za.org>2017-02-13 14:41:16 +0200
committerAndrew Lewis <nerf@judo.za.org>2017-02-13 15:23:26 +0200
commitd4cdf447b822835ee16947f88d88b9b7231d7995 (patch)
tree05bbee3de392fbf804b456e2438891013349f1e5 /rules/misc.lua
parent3125cf20b87ff211cf2326b9682b39703a996066 (diff)
downloadrspamd-d4cdf447b822835ee16947f88d88b9b7231d7995.tar.gz
rspamd-d4cdf447b822835ee16947f88d88b9b7231d7995.zip
[Minor] Yield matched title in FROM_NAME_HAS_TITLE rule
Diffstat (limited to 'rules/misc.lua')
-rw-r--r--rules/misc.lua10
1 files 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