[Rspamd-Users] GPT and FREEMAIL_FROM question

Stanislav me at rooty.name
Mon Aug 18 23:09:15 UTC 2025


Hi there,

I'm using the GPT module with "allow_ham = false". I'd like to keep it 
that way, but I also want GPT to trigger whenever an email has the 
FREEMAIL_FROM symbol, regardless of ham/spam.

My first attempt was this configuration:
===
enabled = true;
type = "openai";
max_tokens = 2000;
api_key = "aaaa";
allow_ham = false;
condition = <<EOD
return function(task)
   if task:has_symbol('FREEMAIL_FROM') then
     return true
   end
   local score = task:get_metric_score()
   return score >= 0
end
EOD;
===

But I found that it doesn't work because GPT gets skipped on 
negative-score messages before the condition is even checked.

So now I'm trying the opposite approach - setting "allow_ham = true", 
with the following condition function:
===
return function(task)
   if task:has_symbol('FREEMAIL_FROM') then
     return true
   end
   local sc = task:get_metric_score()
   local score = type(sc) == 'table' and sc[1] or sc
   return (score or 0) >= 0
end
===

 From what I understand, with "allow_ham = true", the condition should 
check for FREEMAIL_FROM and trigger GPT if it's there, otherwise behave 
the same as when "allow_ham = false".

For some reason, though, that's not happening. When I test with rspamc, 
I don't see the GPT_SPAM symbol.

Any ideas what I might be missing? I'd really appreciate the help

Thanks


More information about the Users mailing list