[Rspamd-Users] action settings per recipient with defaults

Harry Gill harry at enhance.com
Mon Apr 20 14:45:40 UTC 2020

Hi there

I'm trying to achieve a custom action threshold based on the recipient. I'm
using redis to load a custom setting based on the recipient of the message.
Reading from the docs here
I have the following in my `/etc/rspamd/local.d/rspamd.conf` file

> # Redis settings are configured in a "settings_redis" block
> # DRAWBACK setting will get picked for the first recipient in the list
> # even though other recipients may have different settings.
> settings_redis {
> # Here we will define our Lua functions
> handlers = {
> # Everything in here is a Lua function with an arbitrary name
> get_rcpt_address = <<EOD
> return function(task)
> -- get a list of recipients form the message
> local rcpt = task:get_recipients('any')
> -- lua lists index starts at 1 not 0 XD
> -- Return nothing if we can't find address of first SMTP recipient
> if not (rcpt and rcpt[1] and rcpt[1]['addr']) then return end
> -- Return "setting:" concatenated with the address
> local key = 'setting:' .. rcpt[1]['addr']
> return key;
> end
> EOD;
> }
> }

settings are set in redis as
$redis > get setting:address at example.com
$redis > "{actions{reject=50;greylist=5;\"add header\"=8;}}"

It doesn't seem to work unfortunately, what am I doing wrong here?
Thanks in advance
H Gill

More information about the Users mailing list