How to reset HAM / SPAM trainings and re-train manually?

I thought I could reset the training that had taken place over time, as I suspect that my users had misclassified some emails (moving them to or from the JUNK folder).

I tried to do this via

redis-cli -s /run/redis/persistent.sock --scan --pattern 'BAYES_*' \
  | xargs -r redis-cli -s /run/redis/persistent.sock DEL

redis-cli -s /run/redis/persistent.sock --scan --pattern 'RS_*' \
  | xargs -r redis-cli -s /run/redis/persistent.sock DEL

But the statistics do not change.

How can I manually retrain rSpamd afterwards using rspamc learn_ham and rspamc learn_spam?

I did:

:~# runagent -m mail1
~/.config/state$ runagent -m mail1 podman exec -ti rspamd sh

But can’t find the necessary paths like

rspamc learn_ham /var/lib/nethserver/maildir/user@example.com/Maildir/cur

I also want to adopt my old solution for NS7 to NS8, but I’m lost…

You could remove the rspamd-redis volume but usually it’s not needed to remove the statistics about the already learned spam/ham as it’s retrained.
For example if a mail was learned as spam and you set it as ham using rspamc, it’s not spam anymore.

It needs to be done in the dovecot container, using the rspamc-wrapper.
It’s explained in the ns8-mail README.

2 Likes