[Rspamd-Users] bayes - dovecot/sieve question

Markus Schönhaber rspamd-community at list-post.ddt-consult.de
Mon Sep 25 19:45:20 UTC 2023


25.09.23, 20:40 +0200, Stanislav via Users:

> I struggle to understand the configuration for dovecot/sieve trigger 
> learning spam/ham.
> 
> I'm following this 3rd party manual: 
> https://www.c0ffee.net/blog/mail-server-guide
> 
> So there are following components/files:
> =========== /usr/local/etc/dovecot/sieve/report-spam.sieve
> require ["vnd.dovecot.pipe", "copy", "imapsieve", "environment", 
> "variables"];
> 
> if environment :matches "imap.email" "*" {
>    set "email" "${1}";
> }
> 
> pipe :copy "train-spam.sh" [ "${email}" ];
[...]
> =========== /usr/local/etc/dovecot/sieve/train-spam.sh
> exec /usr/local/bin/rspamc -h /var/run/rspamd/rspamd.sock learn_spam
[...]
> Now, when I move a letter to junk to trigger it - I'm confused about how 
> exactly "rspamc learn_spam" knows what exact email needs to learn. From 
> what I see we pass an "email" only.

The "pipe" sieve command passes the value of ${email} as a parameter to 
the script, while the the mail's content is piped to the script's 
standard input. Therefore, stdin is where your script (and in turn 
rspamc) gets the mail it is supposed to learn.

-- 
Regards
   mks



More information about the Users mailing list