From: Vsevolod Stakhov Date: Thu, 29 Jun 2017 07:58:40 +0000 (+0100) Subject: [Feature] Allow to check reply-to email X-Git-Tag: 1.6.2~57 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4b1814d9a000fd7c98d6c63eaa0bf1d9cdc5a242;p=rspamd.git [Feature] Allow to check reply-to email --- diff --git a/src/plugins/lua/emails.lua b/src/plugins/lua/emails.lua index 11535014a..3c3d103fd 100644 --- a/src/plugins/lua/emails.lua +++ b/src/plugins/lua/emails.lua @@ -104,7 +104,7 @@ end local function check_emails(task) local emails = task:get_emails() local checked = {} - if emails then + if emails and not rule.skip_body then for _,addr in ipairs(emails) do local to_check = string.format('%s@%s', addr:get_user(), addr:get_host()) local naddr = { @@ -123,6 +123,26 @@ local function check_emails(task) end end end + + for _,rule in ipairs(rules) do + if rule.check_replyto then + local function get_raw_header(task, name) + return ((task:get_header_full(name) or {})[1] or {})['raw'] + end + + local replyto = get_raw_header(task, 'Reply-To') + if not replyto then return false end + local rt = util.parse_mail_address(replyto) + + if rt and rt[1] then + rspamd_lua_utils.remove_email_aliases(rt[1]) + if not checked[rt[1].addr] then + check_email_rule(task, rule, rt[1]) + checked[rt[1].addr] = true + end + end + end + end end local opts = rspamd_config:get_all_opt('emails', 'rule')