Sebastian Nielsen
2020-May-09 17:33 UTC
SV: Marking all emails in "Trash" as opened, and also prohibiting email clients from creating new ma
I tried with following: require ["imap4flags"]; if not hasflag :is "\\Seen" { setflag "\\Seen"; } And then this in plugins.conf: plugin { sieve_plugins = sieve_imapsieve imapsieve_mailbox1_name = Trash imapsieve_mailbox1_before = file:/etc/dovecot/sieve/trash.sieve } It works in outlook, the mail is opened (mark as read) when it goes to trash. But in Samsung Email it doesn't work. (or it works when I select in Samsung email, "Move to Folder" and then "Trash", but if I select "Delete", the mail is trashed without becoming read) (I have checked, the sieve script gets executed) -----Ursprungligt meddelande----- Fr?n: dovecot-bounces at dovecot.org <dovecot-bounces at dovecot.org> F?r Marc Roos Skickat: den 9 maj 2020 18:30 Till: dovecot <dovecot at dovecot.org> ?mne: RE: Marking all emails in "Trash" as opened, and also prohibiting email clients from creating new ma Someone just told me about imapsieve. Sieve rules for folders. I assume that could solve your issue. https://wiki.dovecot.org/HowTo/AntispamWithSieve -----Original Message----- Sent: 09 May 2020 17:32 To: dovecot at dovecot.org Subject: Marking all emails in "Trash" as opened, and also prohibiting email clients from creating new mails Dovecot version: 2.3.7.2 (3c910f64b) (pkg shipped by: Ubuntu-Desktop 20.04) I want to accomplish 2 things in dovecot: 1: I want to force all mails inside Trash to have an "opened"/"read" flag and "Non-Recent" flag. Basically Status: RO This regardless how the flag appears, either by copying/moving the mail into trash, creating a new mail in trash, flagging email in Trash or whatever. Basically, no email in Trash should ever be able to have a recent or unread flag. I tried with a static mail filter and sieve filter to add \\seen to the email upon COPY (as mentioned here: https://dovecot.org/pipermail/dovecot/2017-November/110122.html ), but regardless how I do it, it doesn't work when Samsung Email client trashes an unread email, AND/OR also, it causes weird issues like duplicate email in the trash folder sometimes. Best would be some event filter that executes for every mail that somehow end up in Trash, that checks if \\seen is present, if not, then it will add it, on all emails in trash? But how I do to prevent the duplicate copy that appears sometimes? 2: I want to prohibit email clients from ever creating a new mail in Sent folder. If its possible to allow MOVE and/or COPY, it should be allowed, only new mail should be prohibited. (also note that external processes must be able to create new mail in Sent) HOWEVER - this prohibition must be silent - ergo the newly created email is simply discarded. No error message or error codes should be returned to IMAP client. (The reason I want this, is because I have configured my outgoing SMTP server to populate Sent, and some email clients doesn't have the option to "Don't store a copy of the email in Sent folder" resulting in duplicates) Best regards, Sebastian Nielsen -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 5249 bytes Desc: S/MIME Cryptographic Signature URL: <https://dovecot.org/pipermail/dovecot/attachments/20200509/9b410b3c/attachment.p7s>
Sebastian Nielsen
2020-May-09 17:59 UTC
SV: Marking all emails in "Trash" as opened, and also prohibiting email clients from creating new ma
Another problem, is that running discard; on the Sent folder, just marks the email for deletion - ergo it gets a strike-through. It doesn't get deleted. Tried with both Before and After. Otherwise, the discard; on Sent folder works fine - ergo it only selects emails that were written through IMAP, it doesn't select emails written from appendfile in exim4, which is good. So now I somehow need to get exim4 to actually delete the email completely and not just mark it for deletion. -----Ursprungligt meddelande----- Fr?n: Sebastian Nielsen <sebastian at sebbe.eu> Skickat: den 9 maj 2020 19:33 Till: dovecot at dovecot.org ?mne: SV: Marking all emails in "Trash" as opened, and also prohibiting email clients from creating new ma I tried with following: require ["imap4flags"]; if not hasflag :is "\\Seen" { setflag "\\Seen"; } And then this in plugins.conf: plugin { sieve_plugins = sieve_imapsieve imapsieve_mailbox1_name = Trash imapsieve_mailbox1_before = file:/etc/dovecot/sieve/trash.sieve } It works in outlook, the mail is opened (mark as read) when it goes to trash. But in Samsung Email it doesn't work. (or it works when I select in Samsung email, "Move to Folder" and then "Trash", but if I select "Delete", the mail is trashed without becoming read) (I have checked, the sieve script gets executed) -----Ursprungligt meddelande----- Fr?n: dovecot-bounces at dovecot.org <dovecot-bounces at dovecot.org> F?r Marc Roos Skickat: den 9 maj 2020 18:30 Till: dovecot <dovecot at dovecot.org> ?mne: RE: Marking all emails in "Trash" as opened, and also prohibiting email clients from creating new ma Someone just told me about imapsieve. Sieve rules for folders. I assume that could solve your issue. https://wiki.dovecot.org/HowTo/AntispamWithSieve -----Original Message----- Sent: 09 May 2020 17:32 To: dovecot at dovecot.org Subject: Marking all emails in "Trash" as opened, and also prohibiting email clients from creating new mails Dovecot version: 2.3.7.2 (3c910f64b) (pkg shipped by: Ubuntu-Desktop 20.04) I want to accomplish 2 things in dovecot: 1: I want to force all mails inside Trash to have an "opened"/"read" flag and "Non-Recent" flag. Basically Status: RO This regardless how the flag appears, either by copying/moving the mail into trash, creating a new mail in trash, flagging email in Trash or whatever. Basically, no email in Trash should ever be able to have a recent or unread flag. I tried with a static mail filter and sieve filter to add \\seen to the email upon COPY (as mentioned here: https://dovecot.org/pipermail/dovecot/2017-November/110122.html ), but regardless how I do it, it doesn't work when Samsung Email client trashes an unread email, AND/OR also, it causes weird issues like duplicate email in the trash folder sometimes. Best would be some event filter that executes for every mail that somehow end up in Trash, that checks if \\seen is present, if not, then it will add it, on all emails in trash? But how I do to prevent the duplicate copy that appears sometimes? 2: I want to prohibit email clients from ever creating a new mail in Sent folder. If its possible to allow MOVE and/or COPY, it should be allowed, only new mail should be prohibited. (also note that external processes must be able to create new mail in Sent) HOWEVER - this prohibition must be silent - ergo the newly created email is simply discarded. No error message or error codes should be returned to IMAP client. (The reason I want this, is because I have configured my outgoing SMTP server to populate Sent, and some email clients doesn't have the option to "Don't store a copy of the email in Sent folder" resulting in duplicates) Best regards, Sebastian Nielsen -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 5249 bytes Desc: S/MIME Cryptographic Signature URL: <https://dovecot.org/pipermail/dovecot/attachments/20200509/11a01fa8/attachment.p7s>
Mark Constable
2020-May-10 01:47 UTC
SV: Marking all emails in "Trash" as opened, and also prohibiting email clients from creating new ma
On 10/5/20 3:33 am, Sebastian Nielsen wrote:> And then this in plugins.conf: > > plugin { > sieve_plugins = sieve_imapsieve > imapsieve_mailbox1_name = Trash > imapsieve_mailbox1_before = file:/etc/dovecot/sieve/trash.sieve > }Maybe adding this will help... imapsieve_mailbox1_causes = COPY FLAG
Sebastian Nielsen
2020-May-10 01:57 UTC
SV: SV: Marking all emails in "Trash" as opened, and also prohibiting email clients from creating ne
Doesn't work in Samsung Email still. And with COPY FLAG set, it doesn't work with outlook either. You need APPEND for it to work in outlook. It currently works in outlook with either no causes restriction, or with COPY FLAG APPEND. But not in Samsung Email. And what I understand, leaving .causes out, should have it match ALL causes. If I look in the dovecot.log with debugging on, it looks like this: May 10 03:53:38 imap-login: Info: Login: user=<sebastian at sebbe.eu>, method=PLAIN, rip=192.168.2.2, lip=192.168.1.10, mpid=3385220, session=<U4PCf0GlaKvAqAIC> May 10 03:53:38 imap(sebastian at sebbe.eu)<3385220><U4PCf0GlaKvAqAIC>: Debug: Loading modules from directory: /usr/lib/dovecot/modules May 10 03:53:38 imap(sebastian at sebbe.eu)<3385220><U4PCf0GlaKvAqAIC>: Debug: Module loaded: /usr/lib/dovecot/modules/lib95_imap_sieve_plugin.so May 10 03:53:38 imap(sebastian at sebbe.eu)<3385220><U4PCf0GlaKvAqAIC>: Debug: Added userdb setting: plugin/=yes May 10 03:53:38 imap(sebastian at sebbe.eu)<3385220><U4PCf0GlaKvAqAIC>: Debug: Effective uid=1001, gid=1001, homeMay 10 03:53:38 imap(sebastian at sebbe.eu)<3385220><U4PCf0GlaKvAqAIC>: Debug: Namespace inbox: type=private, prefix=, sep=, inbox=yes, hidden=no, list=yes, subscriptions=yes location=mbox:/var/mail/asterisk2:INBOX=/var/mail/asterisk May 10 03:53:38 imap(sebastian at sebbe.eu)<3385220><U4PCf0GlaKvAqAIC>: Debug: fs: root=/var/mail/asterisk2, index=, indexpvt=, control=, inbox=/var/mail/asterisk, altMay 10 03:53:38 imap(sebastian at sebbe.eu)<3385220><U4PCf0GlaKvAqAIC>: Debug: Mailbox INBOX: Mailbox opened because: SELECT May 10 03:53:38 imap(sebastian at sebbe.eu)<3385220><U4PCf0GlaKvAqAIC>: Debug: Mailbox Trash: Mailbox opened because: UID MOVE May 10 03:53:38 imap(sebastian at sebbe.eu)<3385220><U4PCf0GlaKvAqAIC>: Debug: Mailbox INBOX: UID 1068: Opened mail because: copying May 10 03:53:38 imap(sebastian at sebbe.eu)<3385220><U4PCf0GlaKvAqAIC>: Debug: imapsieve: mailbox Trash: MOVE event May 10 03:53:38 imap(sebastian at sebbe.eu)<3385220><U4PCf0GlaKvAqAIC>: Error: User sebastian at sebbe.eu doesn't have home dir set, disabling duplicate database May 10 03:53:38 imap(sebastian at sebbe.eu)<3385220><U4PCf0GlaKvAqAIC>: Debug: sieve: Pigeonhole version 0.5.7.2 () initializing May 10 03:53:38 imap(sebastian at sebbe.eu)<3385220><U4PCf0GlaKvAqAIC>: Debug: sieve: Sieve imapsieve plugin for Pigeonhole version 0.5.7.2 () loaded May 10 03:53:38 imap(sebastian at sebbe.eu)<3385220><U4PCf0GlaKvAqAIC>: Debug: imapsieve: Static mailbox rule [1]: mailbox=`Trash' from=`*' causes=(COPY FLAG APPEND) => before=`file:/etc/dovecot/sieve/trash.sieve' after=`file:/etc/dovecot/> May 10 03:53:38 imap(sebastian at sebbe.eu)<3385220><U4PCf0GlaKvAqAIC>: Debug: imapsieve: Static mailbox rule [2]: mailbox=`Sent' from=`*' causes=(APPEND) => before=(none) after=`file:/etc/dovecot/sieve/sent.sieve' May 10 03:53:38 imap(sebastian at sebbe.eu)<3385220><U4PCf0GlaKvAqAIC>: Debug: imapsieve: Matched static mailbox rule [1] May 10 03:53:38 imap(sebastian at sebbe.eu)<3385220><U4PCf0GlaKvAqAIC>: Debug: sieve: file storage: Using Sieve script path: /etc/dovecot/sieve/trash.sieve May 10 03:53:38 imap(sebastian at sebbe.eu)<3385220><U4PCf0GlaKvAqAIC>: Debug: sieve: file script: Opened script `trash' from `/etc/dovecot/sieve/trash.sieve' May 10 03:53:38 imap(sebastian at sebbe.eu)<3385220><U4PCf0GlaKvAqAIC>: Debug: sieve: file storage: Using Sieve script path: /etc/dovecot/sieve/trash.sieve May 10 03:53:38 imap(sebastian at sebbe.eu)<3385220><U4PCf0GlaKvAqAIC>: Debug: sieve: file script: Opened script `trash' from `/etc/dovecot/sieve/trash.sieve' May 10 03:53:38 imap(sebastian at sebbe.eu)<3385220><U4PCf0GlaKvAqAIC>: Debug: sieve: Opening script 1 of 2 from `/etc/dovecot/sieve/trash.sieve' May 10 03:53:38 imap(sebastian at sebbe.eu)<3385220><U4PCf0GlaKvAqAIC>: Debug: sieve: Loading script /etc/dovecot/sieve/trash.sieve May 10 03:53:38 imap(sebastian at sebbe.eu)<3385220><U4PCf0GlaKvAqAIC>: Debug: sieve: Script binary /etc/dovecot/sieve/trash.svbin successfully loaded May 10 03:53:38 imap(sebastian at sebbe.eu)<3385220><U4PCf0GlaKvAqAIC>: Debug: sieve: binary save: not saving binary /etc/dovecot/sieve/trash.svbin, because it is already stored May 10 03:53:38 imap(sebastian at sebbe.eu)<3385220><U4PCf0GlaKvAqAIC>: Debug: sieve: Executing script from `/etc/dovecot/sieve/trash.svbin' May 10 03:53:38 imap(sebastian at sebbe.eu)<3385220><U4PCf0GlaKvAqAIC>: Debug: sieve: Opening script 2 of 2 from `/etc/dovecot/sieve/trash.sieve' May 10 03:53:38 imap(sebastian at sebbe.eu)<3385220><U4PCf0GlaKvAqAIC>: Debug: sieve: Loading script /etc/dovecot/sieve/trash.sieve May 10 03:53:38 imap(sebastian at sebbe.eu)<3385220><U4PCf0GlaKvAqAIC>: Debug: sieve: Script binary /etc/dovecot/sieve/trash.svbin successfully loaded May 10 03:53:38 imap(sebastian at sebbe.eu)<3385220><U4PCf0GlaKvAqAIC>: Debug: sieve: binary save: not saving binary /etc/dovecot/sieve/trash.svbin, because it is already stored May 10 03:53:38 imap(sebastian at sebbe.eu)<3385220><U4PCf0GlaKvAqAIC>: Debug: sieve: Executing script from `/etc/dovecot/sieve/trash.svbin' May 10 03:53:38 imap(sebastian at sebbe.eu)<3385220><U4PCf0GlaKvAqAIC>: Info: sieve: left message in mailbox 'Trash' May 10 03:53:38 imap(sebastian at sebbe.eu)<3385218><hp3Bf0GlZqvAqAIC>: Info: Connection closed (SELECT finished 0.127 secs ago) in=77 out=928 deleted=0 expunged=0 trashed=0 hdr_count=0 hdr_bytes=0 body_count=0 body_bytes=0 May 10 03:53:38 imap(sebastian at sebbe.eu)<3385220><U4PCf0GlaKvAqAIC>: Info: Connection closed (CLOSE finished 0.010 secs ago) in=160 out=1192 deleted=0 expunged=0 trashed=1 hdr_count=0 hdr_bytes=0 body_count=0 body_bytes=0 May 10 03:53:44 imap(sebastian at sebbe.eu)<3385185><wmBDdkGlxP/AqARk>: Debug: Mailbox Trash: Mailbox opened because: SELECT May 10 03:53:44 imap(sebastian at sebbe.eu)<3385185><wmBDdkGlxP/AqARk>: Debug: Mailbox Trash: UID 1190: Opened mail because: full mail Then in trash, its still unread. -----Ursprungligt meddelande----- Fr?n: dovecot-bounces at dovecot.org <dovecot-bounces at dovecot.org> F?r Mark Constable Skickat: den 10 maj 2020 03:48 Till: dovecot at dovecot.org ?mne: Re: SV: Marking all emails in "Trash" as opened, and also prohibiting email clients from creating ne On 10/5/20 3:33 am, Sebastian Nielsen wrote:> And then this in plugins.conf: > > plugin { > sieve_plugins = sieve_imapsieve > imapsieve_mailbox1_name = Trash > imapsieve_mailbox1_before = file:/etc/dovecot/sieve/trash.sieve > }Maybe adding this will help... imapsieve_mailbox1_causes = COPY FLAG -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 5249 bytes Desc: S/MIME Cryptographic Signature URL: <https://dovecot.org/pipermail/dovecot/attachments/20200510/ee42d09c/attachment-0001.p7s>
Possibly Parallel Threads
- SV: Marking all emails in "Trash" as opened, and also prohibiting email clients from creating new ma
- Marking all emails in "Trash" as opened, and also prohibiting email clients from creating new mails
- Marking all emails in "Trash" as opened, and also prohibiting email clients from creating new mails
- Seive + Spamprobe terminates with signal 6
- Sieve_before