From: Andrew Lewis Date: Thu, 9 Mar 2017 15:37:52 +0000 (+0200) Subject: [Fix] Metadata exporter: use rule-specific settings for emails X-Git-Tag: 1.5.3~68^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=786769f7c0f7c9c077321e76e69092a6e2f0106c;p=rspamd.git [Fix] Metadata exporter: use rule-specific settings for emails - Reported by @croessner --- diff --git a/src/plugins/lua/metadata_exporter.lua b/src/plugins/lua/metadata_exporter.lua index 7882a265c..c8717bc5d 100644 --- a/src/plugins/lua/metadata_exporter.lua +++ b/src/plugins/lua/metadata_exporter.lua @@ -137,13 +137,13 @@ local formatters = { default = function(task) return task:get_content() end, - email_alert = function(task) + email_alert = function(task, rule) local meta = get_general_metadata(task, true) - meta.mail_from = settings.mail_from - meta.mail_to = settings.mail_to + meta.mail_from = rule.mail_from or settings.mail_from + meta.mail_to = rule.mail_to or settings.mail_to meta.our_message_id = rspamd_util.random_hex(12) .. '@rspamd' meta.date = rspamd_util.time_to_string(rspamd_util.get_time()) - return simple_template(settings.email_template, meta) + return simple_template(rule.email_template or settings.email_template, meta) end, json = function(task) return ucl.to_format(get_general_metadata(task), 'json-compact') @@ -625,7 +625,7 @@ local function gen_exporter(rule) if selected then rspamd_logger.debugm(N, task, 'Message selected for processing') local formatter = rule.formatter or 'default' - local formatted = formatters[formatter](task) + local formatted = formatters[formatter](task, rule) if formatted then pushers[rule.backend](task, formatted, rule) else