local rspamd_util = require "rspamd_util"
local common = require "lua_scanners/common"
local fun = require "fun"
+local lua_mime = require "lua_mime"
local N = 'cloudmark'
-- Boundary for multipart transfers, generated on module init
symbol_fail = 'CLOUDMARK_FAIL',
symbol = 'CLOUDMARK_CHECK',
symbol_spam = 'CLOUDMARK_SPAM',
+ add_headers = false, -- allow addition of the headers from Cloudmark
}
cloudmark_conf = lua_util.override_defaults(cloudmark_conf, opts)
task:insert_result(rule.symbol_spam, 1.0, tostring(score))
end
+ if rule.add_headers and type(obj.appendHeaders) == 'table' then
+ local headers_add = fun.tomap(fun.map(function(h)
+ return h.headerField,{
+ order = 1, value = h.body
+ }
+ end, obj.appendHeaders))
+ lua_mime.modify_headers(task, {
+ add = headers_add
+ })
+ end
+
end
local function cloudmark_check(task, content, digest, rule, maybe_part)