Sieve duplicates

Ferenc ferenc-dovecot at freedom.nl
Mon Dec 19 23:18:02 UTC 2022


Hi list,

I’m trying this again from a different account because of lots of SPF warnings.  

I have Sieve scripts that duplicate e-mails. I don’t want that. My dovecot version is 2.3.4.1 (f79e8e7e4), Pigeonhole version 0.5.4 on Linux 5.4.189-2-pve x86_64 Debian 10.13.

My scripts get called on an imap COPY action (imapsieve extension). The mail is fed to an external script (spam/ham training or retraining) via a pipe :copy action (vnd.dovecot.pipe extension). An header is added to keep track of what happened (editheader extension). 

I use "if header :contains” for my (simple) logic. If contains header X, do this, add header Y. If contains header Y, do that, add header X. I end each "if” part with “keep;" and “stop;” commands.

Simple versions of the scripts, without the if-then construct, seem to work ok with imapsieve. As soon as I try to use if-then-else I find a duplicate of the processed e-mail; the original mail seems to be untouched, the duplicate appears to have been processed. With macos mail not all duplicates show up but with Roundcube webmail I can see them all.

The scripts are like this:

# without if-then
require …
pipe :copy …
addheader …
keep;


# with if-then
require …

if header :contains
  pipe :copy …
  addheader …
  keep;
  stop;

if not exists
  pipe :copy …
  addheader …
  keep;
  stop;

keep;


The scripts get called from “imapsieve_mailbox1_before” for example.

Cheers,
Ferenc


More information about the dovecot mailing list