Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Setting flags on IMAP mail files maps inconsistently to Thunderbird flags

  • 7 majibu
  • 1 ana tatizo hili
  • 1 view
  • Last reply by Mark Foley

more options

I am investigating moving our office users from Outlook to Thunderbird. One big issue is preserving their Outlook color catagories. The server is IMAP/Dovecot, self-hosted on Linux.

When I set a flag in Thunderbird, it sets the corresponding flag on the IMAP file. For example, setting the Thunderbird flag "1 Important" (red) on message "cur/1451494595.18051_0.mail:2,S" changes the filename to "cur/1451494595.18051_0.mail:2,Sa". So far so good.

If I manually add the flag letter (a-e) to the filename on the IMAP server, the corresponding message is flagged/colored in Thunderbird. For example:

mv "cur/1449002162.8993_0.mail:2,S" "cur/1449002162.8993_0.mail:2,Sb"

Will turn the messing in Thuderbird to yellow (2 Work).

This is all totally awesome! I have a VB script that will extract all color categories from Outlook and another bash script that will rename the IMAP files with the corresponding flag letter. My hope is that I can export all the Outlook category settings and rename the IMAP files so the same categories show as Thunderbird flags and, voila! Goodbye Outlook!

But there's a wrinkle. That works just fine for the Thunderbird inbox, but in a different mail folder the IMAP flag letters and Thunderbird flag numbers map differently:

TB flag inbox other 1 Important a d 2 Work b f 3 Personal c g 4 To Do d h

Note that IMAP flag 'd' designates TB flag 4 in the inbox and TB flag 1 in the other folder.

So, is this a Thunderbird issue? A setting of some sort? Any ideas? I need flags to map consistently.

I am investigating moving our office users from Outlook to Thunderbird. One big issue is preserving their Outlook color catagories. The server is IMAP/Dovecot, self-hosted on Linux. When I set a flag in Thunderbird, it sets the corresponding flag on the IMAP file. For example, setting the Thunderbird flag "1 Important" (red) on message "cur/1451494595.18051_0.mail:2,S" changes the filename to "cur/1451494595.18051_0.mail:2,Sa". So far so good. If I manually add the flag letter (a-e) to the filename on the IMAP server, the corresponding message is flagged/colored in Thunderbird. For example: mv "cur/1449002162.8993_0.mail:2,S" "cur/1449002162.8993_0.mail:2,Sb" Will turn the messing in Thuderbird to yellow (2 Work). This is all totally awesome! I have a VB script that will extract all color categories from Outlook and another bash script that will rename the IMAP files with the corresponding flag letter. My hope is that I can export all the Outlook category settings and rename the IMAP files so the same categories show as Thunderbird flags and, voila! Goodbye Outlook! But there's a wrinkle. That works just fine for the Thunderbird inbox, but in a different mail folder the IMAP flag letters and Thunderbird flag numbers map differently: TB flag inbox other 1 Important a d 2 Work b f 3 Personal c g 4 To Do d h Note that IMAP flag 'd' designates TB flag 4 in the inbox and TB flag 1 in the other folder. So, is this a Thunderbird issue? A setting of some sort? Any ideas? I need flags to map consistently.

All Replies (7)

more options

I really think you need help from developers, not users like us folk here. I suggest you try the dev.apps.thunderbird google group.

https://groups.google.com/forum/#!forum/mozilla.dev.apps.thunderbird or is you prefer is it available on news.mozilla.org as a usenet group.

more options

It looks like my carefully spaced table of flag letters versus folders got all munged onto one line in my posting. I guess I need to eventually figure out the formatting conventions on this forum. I'll try indenting in this message ...

Anyway, I figured it out. Dovecot has a file: dovecot-keywords, which may exist in each mail folder directory. This maps the IMAP filename flag letters to Thunderbird tag values (http://wiki2.dovecot.org/MailboxFormat/Maildir). So, the dovecot-keywords file in my inbox folder was:

 0 $label1
 1 $label2
 2 $label3
 3 $label4
 4 $Labelimportant
 5 $Labelpersonal
 6 $Labelwork
 7 Junk

(Hopefully that comes out as one line per number) While the dovecot-keywords file in the 'other' folder are:

 0 unknown-0
 1 unknown-1
 2 unknown-2
 3 $label1
 4 unknown-4
 5 $label2
 6 $label3
 7 $label4

The ones having "$label" are the Thunderbird keywords. Therefore, in the inbox $label1 gets mapped to an "a" flag letter while $label1 in the other folder gets mapped to a "d". This explains the question in my posting.

The non-Thunderbird keywords (without "$label") are from the current Outlook mail client, though I've never noticed what attribute they visually map to when using Outlook.

My migration solution will be to make sure all dovecot-keyword files in all Maildir directories for all users look like:

0 $label1  = 1 Important   IMAP flag 'a'
1 $label2  = 2 Work        IMAP flag 'b' 
2 $label3  = 3 Personal    IMAP flag 'c'
3 $label4  = 4 To Do       IMAP flag 'd'
4 $label5  = 5 Later       IMAP flag 'e'

(note that the text from the '=' sign to the end is NOT part of the dovecot-keyword file. I've put that commentary there to show the correlations)

Then run my rename script to parse the exported Outlook color categories and append the flag letter(s) to the mail filenames. This will end up mapping one-to-one with Thunderbird tags and I will effect our migration away from Outlook! Yeah!

(Note: I could go the extra mile and keep the existing dovecot-keywords files and modify the script to look up the appropriate flag letter in that file, but I'd rather start Thunderbird clean and know that all IMAP filenames ending in 'a' are Thunderbird tag "0 Important". Also, I'm not sure what the "$Labelimportant" keywords are. Are they from Outlook? Thunderbird? For now, I'm going to pretend these don't exist!)

If someone has read this far and does want to help, is there a way to change the text used to display the Thunderbird tags? For example, is there a way to change "0 Important" to be "0 Red Category"?

Modified by Mark Foley

more options

Tags are defined in the settings, e.g.

Name                         Status    Type      Value    
mailnews.tags.$label1.color  user set  string    #FF0000
mailnews.tags.$label1.tag    user set  string    Important

Obviously you could go through each installation and do this by hand in the Config Editor.

But since the settings are stored in the file prefs.js, you could do an automated search-and-replace on this file. Just make sure Thunderbird is closed and not running when you edit this file.

Do test it on a non-production set-up. Errors in the prefs files can totally break Thunderbird.

Amazing amount of effort for a feature I've never even used. Some of us just don't "get" tags. ;-)

BTW, the actual line you'd need to edit looks like this:

user_pref("mailnews.tags.$label1.tag", "Important");

Modified by Zenos

more options

Zenos - thanks a lot for your answer. This will be really useful for our migration.

"Amazing amount of effort for a feature I've never even used."

You are right! I'd never even noticed this feature on Outlook (but I rarely use Outlook) until our Director made a big deal about it when we got off Exchange and wend to Dovecot/IMAP and he couldn't find his categories. I was able to recover these, but Microsoft didn't make it easy. Our Director has nearly 19,000 emails and "color categories" is his main organization tool. Naturally, we cannot migrate from Outlook to anything if that info can't be preserved. Now it can!

more options

check the config editor for mailnews.tags. the preinstalled ones are label 1 to 5 after that they have names

more options

one should not just click Post on stuff that has been sitting there 24 hours. Sorry guys.

more options

Thanks Matt. That's a useful bit of info too.