4

I am filtering my mails with sieve. I would like to mark certain messages so that they show up in Thunderbird with the corresponding tag.

The examples say that require "imap4flags"; followed by an addflag "$label1"; in a statement is supposed to assign the first tag, that is defined in Thunderbird -- unfortunately not in my case.

Any idea what goes wrong here? Everything else is working like charm.

EDIT

Minimal, complete, and verifiable example:

The sieve script for an account looks like this:

require ["regex", "fileinto", "imap4flags"];
if address :regex ["From"] [
  "flagtest"
] {
  fileinto "IT";
  addflag "$label1";
  stop;
}

I have one individually defined label "Wichtig":

enter image description here

I sent an e-mail from flagtest@domain1.tld to account@domain2.tld. The e-mail has been filed into the folder "IT". The e-mail is not flagged as "Wichtig".

This behaviour has been tested using Dovecot 2.2.22.

Vince42
  • 216
  • 1
  • 10
  • I'm not sure if this is an issue with your sieve script or some other server configuration problem. Can you post a [mcve] of a script that doesn't work, maybe an email that you expect to trigger it if that might be the problem, and more details on the server? Are you using Dovecot, or just linking its sieve examples? There may be [some setup](https://wiki2.dovecot.org/MailboxFormat/Maildir#IMAP_keywords) of flags needed based on what mailbox format Dovecot is using, though it may be that Thunderbird is supposed to set those up itself. –  May 24 '18 at 23:45
  • Sorry, missed your comment - added a minimal complete and verifiable example now and took all your recommendations into consideration. – Vince42 Mar 06 '19 at 22:55

2 Answers2

0

the addrflag command is correct and works for me with Thunderbird, so the problem is either the order of operations, or the server that Thunderbird is connecting to; i use the same Sieve command to set Thunderbird "tags", except i do it before fileinto, rather than after:

if header :contains ["to", "cc", "resent-to", "x-delivered-to"] [
    "addressexample@xyz.com"
    ]
{
  addflag "$label2";
  fileinto "INBOX.community.addressexample";
  stop;
}

i have labels 1 through 5 pre-defined in Thunderbird; i'm using Thunderbird 60.9.1 on macOS, and this has worked well for me for several years; i wouldn't say this proves that the order is what matters — it could be a difference between your email server and mine (i use Fastmail service, based on Cyrus)

sporobolus
  • 21
  • 2
  • Thank you for your answer. I will set up a new server in the next weeks, so hopefully the new setup might behave as yours. Keep fingers crossed. ;) But it is good to know that there is no general problem with flags and thunderbird. – Vince42 May 28 '22 at 21:35
-1

I just started using Sieve but if I understand you correctly you want to add a label to mail.

fileinto "mylabel";

Because folders and labels are equal here you can use fileinto command.

Tim
  • 190
  • 5
  • 19
  • GMail uses folders as labels, the typical IMAP server does not. I am already filing my mails into folders, but I want to make use of Thunderbird's tags to tag my mails in addition to filing them into IMAP folders. Just to give an example: I have plenty of mails in my Customer subfolder, but I want to flag some of them as "Important" based on specific criteria. – Vince42 Jan 29 '23 at 17:25