diff options
author | Andrew Lewis <nerf@judo.za.org> | 2018-03-28 14:46:40 +0200 |
---|---|---|
committer | Andrew Lewis <nerf@judo.za.org> | 2018-03-28 14:46:40 +0200 |
commit | 999f304df46b89dc157524cc7d1c2ad2d635f556 (patch) | |
tree | 6e08840e5ad0453f9b369b2f95e87afa40185b59 /src/plugins/lua/metadata_exporter.lua | |
parent | f03c7fe732ba335f84514bccac42d649f5c998ca (diff) | |
download | rspamd-999f304df46b89dc157524cc7d1c2ad2d635f556.tar.gz rspamd-999f304df46b89dc157524cc7d1c2ad2d635f556.zip |
[Fix] Fix metadata exporter send_mail backend (#2124)
Diffstat (limited to 'src/plugins/lua/metadata_exporter.lua')
-rw-r--r-- | src/plugins/lua/metadata_exporter.lua | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/plugins/lua/metadata_exporter.lua b/src/plugins/lua/metadata_exporter.lua index 523b4251c..fd0c73179 100644 --- a/src/plugins/lua/metadata_exporter.lua +++ b/src/plugins/lua/metadata_exporter.lua @@ -370,7 +370,21 @@ local pushers = { end end from_done_cb = function(merr, mdata) - local k = next(extra.mail_targets) + local k + if extra then + k = next(extra.mail_targets) + else + extra = {mail_targets = {}} + if type(rule.mail_to) == 'string' then + extra = {mail_targets = {}} + k = rule.mail_to + elseif type(rule.mail_to) == 'table' then + for _, r in ipairs(rule.mail_to) do + extra.mail_targets[r] = true + end + k = next(extra.mail_targets) + end + end extra.mail_targets[k] = nil conn:add_write(rcpt_cb, {'RCPT TO: <', k, '>\r\n'}) end |