Sieve addflag "$label1" does not show in Thunderbird

925 Views Asked by At

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 [email protected] to [email protected]. 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.

2

There are 2 best solutions below

1
On

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"] [
    "[email protected]"
    ]
{
  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)

1
On

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.