[Rspamd-Users] How to use lua_mime.add_text_footer

Vsevolod Stakhov vsevolod at rspamd.com
Thu Apr 15 16:58:30 UTC 2021


Hello,

On 15/04/2021 17:49, Alexander Meinhardt wrote:
> Hello,
> 
> i'm trying to implement the function lua_mime.add_text_footer to my
> setup, but i didn't get the things working.
> 
> rspamd.local.lua in /etc/rspamd:
> 
>> local lua_mime = require "lua_mime"
>> rspamd_config.FOOTER_SIGNATURE = {
>>  callback = function(task)
>>    local authuser = task:get_user()
>>    if authuser then
>>      local at_symbol = authuser:find("[^%@]+$")
>>      local username = authuser:sub(1, (at_symbol - 2))
>>      local domain = authuser:sub(at_symbol, #authuser)
>>      local signature_path = "/var/lib/rspamd/signature/"
>>      local signature_plain = signature_path .. domain .. "/" .. username .. "/signature.txt"
>>      local signature_html = signature_path .. domain .. "/" .. username .. "/signature.html"
>>      local file_plain = io.open(signature_plain, "r")
>>      local file_html = io.open(signature_html, "r")
>>      if file_plain~=nil and file_html~=nil then
>>        io.close(file_plain)
>>        io.close(file_html)
>>        lua_mime.add_text_footer(task, signature_plain, signature_html)
>>        return true
>>      end
>>    end
>>    return false
>>  end,
>>  score = 0.0,
>>  group = 'mime',
>>  description = 'Adds a footer signature to the message'
>> }
> 
> The authenticated user gets the symbol FOOTER_SIGNATURE added, when
> the files signature.txt/html exists, but the mime part of the message
> isn't altered.
> There are no errors.
> 
> How do i need to use this? Am I missing a required module or so?
> 
> Kind regards from Germany
> Alex
> 

Please check this snippet for the reference:
https://gist.github.com/vstakhov/3dda60a5638a6aefd454973bd687fc21


More information about the Users mailing list