From bd99079363d36d762d3862a4df6f026692560cba Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Sun, 16 Apr 2023 20:30:03 +0200 Subject: [PATCH] mail-server/dovecot: also learn spam/ham on APPEND The current configuration doesn't work when moving spam from the INBOX to Junk on a local maildir and then syncing the result to the IMAP server with `mbsync(1)`. This is because `mbsync(1)` doesn't support a mvoe-detection[1] (i.e. an IMAP MOVE which subsequently causes a Sieve COPY according to RFC6851 which then triggers report{h,sp}am.sieve), but instead sends `APPEND` (and removes the message in the src mailbox after that). Tested on my own mailserver that this fixes spam learning. This doesn't work the other way round though because `APPEND` doesn't have an origin. However, learning mails as spam happens more often than learning spam as ham, so this is IMHO still useful. [1] https://sourceforge.net/p/isync/mailman/isync-devel/thread/87y2p1tihz.fsf%40ericabrahamsen.net/#msg37030483 --- mail-server/dovecot.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mail-server/dovecot.nix b/mail-server/dovecot.nix index 18a9262..b1c4e59 100644 --- a/mail-server/dovecot.nix +++ b/mail-server/dovecot.nix @@ -243,7 +243,7 @@ in # From elsewhere to Spam folder imapsieve_mailbox1_name = ${junkMailboxName} - imapsieve_mailbox1_causes = COPY + imapsieve_mailbox1_causes = COPY,APPEND imapsieve_mailbox1_before = file:${stateDir}/imap_sieve/report-spam.sieve # From Spam folder to elsewhere