Score:0

Dovecot + imap_sieve learning spam

es flag

Have dovecot+sieve. It's most often recommended that users train spamassassin/rspamd in the following way: A Spam folder is created in each mailbox (Junk type) Further, through the imap_sieve plugin, we look, if the letters are moved to this folder, then we consider them spam and call the script (in this case, spam.sh)

require ["vnd.dovecot.pipe", "copy", "imapsieve", "environment", "variables"];

    if environment :matches "imap.user" "*" {
      set "username" "${1}";
      }

      pipe :copy "spam.sh" [ "${username}-spam" ]; 

If these are normal emails, then when moving FROM the spam folder to any other, we consider them ham and call the ham.sh script

require ["vnd.dovecot.pipe", "copy", "imapsieve", "environment", "variables"];

  if environment :matches "imap.mailbox" "*" {
  set "mailbox" "${1}";
}

  if string "${mailbox}" "Trash" {
  stop;
}

  if environment :matches "imap.user" "*" {
  set "username" "${1}";
}

pipe :copy "ham.sh" [ "${username}-ham" ]; 

So the question is, how does this normally work? Emails after "Antispam" that scored average points are usually placed in the inbox marked SPAM. If it's really spam, we move them to the Spam folder, everything is ok here. But what if SPAM mark received a normal email? In order for the ham script to work, you need to place them first in the spam folder and then move them from there to another, and you get two script calls for one email (both spam and ham), makes no sense for me.

tripleee avatar
ar flag
It trains on the whole folder when you call it. You can force run `ham.sh` periodically if you really want to, but simply amortizing it so that it gets retrained whenever there is a false positive is often sufficient.
cozby avatar
es flag
call ham.sh in what folder? inbox? for all users? If we see at spam folder, what will be with spamassassin if we will give it same mail as spam and ham? Is it ok for bayes? If not i don't understand why this method is good (in main post)
tripleee avatar
ar flag
For the user who wants to retrain it.
cozby avatar
es flag
How they will trigger retrain (ham.sh)?
tripleee avatar
ar flag
You'll probably need to set up some additional infrastructure if you want to expose that to end useers.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.