0

Im having some difficulties with preventing emails in "Trash" to have a "unread" flag (which causes a stockpile of notifications on my phone).

I have in dovecot managed, to add the "\Seen" flag to all emails in Trash. However, this only works in certain email clients. some buggy IMAP clients doesn't work with this sieve filter, so all unread emails deleted from that buggy client cause a unread email to pop up in Trash.

So I have got the idea of using a Cron script that gonna run hourly, to fix it now.

How could I solve it?

In dovecot, I use the MBOX format, which uses a single file for each IMAP folder, containing all emails.

Technically, I could use some sort of CRON-compatible client that are able to modify MBOX FIles, to open the "Trash" folder, lock it in dovecot-compatible way (so dovecot and my script doesn't step on each other toes), iterate through the folder, and if the header "Status:" exist delete it, and then (regardless of if the header existed or not) add the header "Status: RO".

Any idea how this could be accomplished in the simplest way possible? Basically, iterate through all messages in a "Trash" MBOX file and delete all "Status:" headers, and then add a "Status: RO" header to all messages.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.