problem with Sieve Duplicate Extension when used together with fileinto

Marco Giunta giunta at sissa.it
Thu Apr 21 11:03:06 UTC 2016


Hi at all,
I'm trying to figure out a problem with Sieve Duplicate Extension when 
used together with fileinto. I use a Dovecot 2.2.23 and Pigeonhole v0.4.13

I have a user (user01) with 3 email addresses (mail01 at example.com, 
mail02 at example.com, user01 at example.com); I want to discard duplicate, 
and I want to move email in different folder, so I'm using this sieve 
script:

----------------------------------------------
require ["fileinto", "duplicate", "imap4flags"];

if duplicate {
         discard;
         stop;
}

if address :is :all "to" "mail01 at example.com" {
         fileinto "mail01";
}

if address :is :all "to" "mail02 at example.com" {
         fileinto "mail02";
}
-------------------------------------


To make my test, I have a script that send always the same email; this 
is an example:

-----------------------------------------
Delivered-To: user01 at example.com
Received: from smtp-server.example.com ([192.168.1.214])
         by lmtp-server.example.com (Dovecot) with LMTP id 
YSaBBU53GFdhbwAAIDyJFw
         for <user01 at example.com>; Thu, 21 Apr 2016 08:48:41 +0200
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: TEST EMAIL
From: myself at example.com
To: mail01 at example.com, mail02 at example.com, user01 at example.com
Date: Thu, 21 Apr 2016 08:48:41 +0200
Message-ID: <20160421064841.26889.86769 at kratos.example.com>

This is a test email

Please ignore me.
--------------------------------------------

The problem is that duplicate extension doesn't ALWAYS work ; I mean, 
one time it works (sieve discard 2 duplicate mails), one time it doesn't 
  work at all (sieve doesn't discard any mail), another time it works 
only for one mail (sieve discards only 1 mail)

Here my server log:

Apr 21 08:49:07 smtp-server dovecot: lmtp(user01 at example.com): 
1dKXOMl3GFdibwAAIDyJFw: sieve: 
msgid=<20160421064906.26896.49900 at myhost.example.com>: stored mail into 
mailbox 'mail01'
Apr 21 08:49:07 smtp-server dovecot: lmtp(user01 at example.com): 
1dKXOMl3GFdibwAAIDyJFw: sieve: 
msgid=<20160421064906.26896.49900 at myhost.example.com>: stored mail into 
mailbox 'mail02'
Apr 21 08:49:07 smtp-server dovecot: lmtp(user01 at example.com): 
oSM3And3GFdFaQAAIDyJFw: sieve: 
msgid=<20160421064906.26896.49900 at myhost.example.com>: marked message to 
be discarded if not explicitly delivered (discard action)
Apr 21 08:49:07 smtp-server dovecot: lmtp(user01 at example.com): 
eY00CY93GFcucgAAIDyJFw: sieve: 
msgid=<20160421064906.26896.49900 at myhost.example.com>: marked message to 
be discarded if not explicitly delivered (discard action)



Apr 21 08:49:13 smtp-server dovecot: lmtp(user01 at example.com): 
dSOyOtV3GFcmdAAAIDyJFw: sieve: 
msgid=<20160421064913.26904.88802 at myhost.example.com>: stored mail into 
mailbox 'mail01'
Apr 21 08:49:13 smtp-server dovecot: lmtp(user01 at example.com): 
dSOyOtV3GFcmdAAAIDyJFw: sieve: 
msgid=<20160421064913.26904.88802 at myhost.example.com>: stored mail into 
mailbox 'mail02'
Apr 21 08:49:13 smtp-server dovecot: lmtp(user01 at example.com): 
pSM3And3GFdFaQAAIDyJFw: sieve: 
msgid=<20160421064913.26904.88802 at myhost.example.com>: marked message to 
be discarded if not explicitly delivered (discard action)
Apr 21 08:49:13 smtp-server dovecot: lmtp(user01 at example.com): 
vZWNOMl3GFcldAAAIDyJFw: sieve: 
msgid=<20160421064913.26904.88802 at myhost.example.com>: marked message to 
be discarded if not explicitly delivered (discard action)



Apr 21 08:49:18 smtp-server dovecot: lmtp(user01 at example.com): 
eSOyOtV3GFcmdAAAIDyJFw: sieve: 
msgid=<20160421064918.26911.55371 at myhost.example.com>: stored mail into 
mailbox 'mail01'
Apr 21 08:49:18 smtp-server dovecot: lmtp(user01 at example.com): 
qSM3And3GFdFaQAAIDyJFw: sieve: 
msgid=<20160421064918.26911.55371 at myhost.example.com>: stored mail into 
mailbox 'mail01'
Apr 21 08:49:18 smtp-server dovecot: lmtp(user01 at example.com): 
qSM3And3GFdFaQAAIDyJFw: sieve: 
msgid=<20160421064918.26911.55371 at myhost.example.com>: stored mail into 
mailbox 'mail02'
Apr 21 08:49:18 smtp-server dovecot: lmtp(user01 at example.com): 
aSaBBU53GFdhbwAAIDyJFw: sieve: 
msgid=<20160421064918.26911.55371 at myhost.example.com>: stored mail into 
mailbox 'mail01'
Apr 21 08:49:18 smtp-server dovecot: lmtp(user01 at example.com): 
aSaBBU53GFdhbwAAIDyJFw: sieve: 
msgid=<20160421064918.26911.55371 at myhost.example.com>: stored mail into 
mailbox 'mail02'
Apr 21 08:49:18 smtp-server dovecot: lmtp(user01 at example.com): 
eSOyOtV3GFcmdAAAIDyJFw: sieve: 
msgid=<20160421064918.26911.55371 at myhost.example.com>: stored mail into 
mailbox 'mail02'


Apr 21 08:49:22 smtp-server dovecot: lmtp(user01 at example.com): 
rSM3And3GFdFaQAAIDyJFw: sieve: 
msgid=<20160421064922.26919.68793 at myhost.example.com>: stored mail into 
mailbox 'mail01'
Apr 21 08:49:22 smtp-server dovecot: lmtp(user01 at example.com): 
rSM3And3GFdFaQAAIDyJFw: sieve: 
msgid=<20160421064922.26919.68793 at myhost.example.com>: stored mail into 
mailbox 'mail02'
Apr 21 08:49:22 smtp-server dovecot: lmtp(user01 at example.com): 
YVCsNPJ3GFd1dgAAIDyJFw: sieve: 
msgid=<20160421064922.26919.68793 at myhost.example.com>: marked message to 
be discarded if not explicitly delivered (discard action)
Apr 21 08:49:23 smtp-server dovecot: lmtp(user01 at example.com): 
bSaBBU53GFdhbwAAIDyJFw: sieve: 
msgid=<20160421064922.26919.68793 at myhost.example.com>: marked message to 
be discarded if not explicitly delivered (discard action)


Apr 21 08:49:27 smtp-server dovecot: lmtp(user01 at example.com): 
fSOyOtV3GFcmdAAAIDyJFw: sieve: 
msgid=<20160421064927.26926.28383 at myhost.example.com>: stored mail into 
mailbox 'mail01'
Apr 21 08:49:27 smtp-server dovecot: lmtp(user01 at example.com): 
sSM3And3GFdFaQAAIDyJFw: sieve: 
msgid=<20160421064927.26926.28383 at myhost.example.com>: stored mail into 
mailbox 'mail01'
Apr 21 08:49:27 smtp-server dovecot: lmtp(user01 at example.com): 
sSM3And3GFdFaQAAIDyJFw: sieve: 
msgid=<20160421064927.26926.28383 at myhost.example.com>: stored mail into 
mailbox 'mail02'
Apr 21 08:49:27 smtp-server dovecot: lmtp(user01 at example.com): 
fSOyOtV3GFcmdAAAIDyJFw: sieve: 
msgid=<20160421064927.26926.28383 at myhost.example.com>: stored mail into 
mailbox 'mail02'
Apr 21 08:49:27 smtp-server dovecot: lmtp(user01 at example.com): 
ZVCsNPJ3GFd1dgAAIDyJFw: sieve: 
msgid=<20160421064927.26926.28383 at myhost.example.com>: marked message to 
be discarded if not explicitly delivered (discard action)


As you can see, the message ID of a single sent, is the same, so the 
duplicate extension should work. If I replace the 'fileinto' rule with, 
for example, a 'setflag' rule:

-----------------------------------------------
require ["fileinto", "duplicate", "imap4flags"];

if duplicate  {
         discard;
	stop;
}

if address :is :all "to" "mail01 at example.com" {
         setflag "\\seen";
}

if address :is :all "to" "mail02 at example.com" {
	setflag "\\seen";
}
----------------------------------------------

it works like a charm: for every mail sent, the duplicate extension works.


What is it wrong ? someone has any clue ?

Cheers,
   Marco






-- 
Marco Giunta - ITCS SysAdmin
Via Bonomea, 265
34136 - Trieste, Italy
Tel: +39-040-3787-503
Fax: +39-040-3787-244


More information about the dovecot mailing list