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@dovecot.org <dovecot-bounces@dovecot.org> För Marc Roos Skickat: den 9 maj 2020 18:30 Till: dovecot <dovecot@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@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