Tags

From MozillaZine Knowledge Base
Jump to navigationJump to search

Tags are descriptive, colored text assigned to messages, used to organize and group messages. Tags can be manually assigned by keyboard, or by message filters.

Assigning and Removing

To manually assign a tag either:

  • right click and choose Tag from the context menu
  • use the Tag button in the toolbar
  • use the Tag button in the message header
  • type a number from 1-9 which corresponds to tag as shown in the context menu

To remove tags:

  • right click and choose Tag from the context menu
  • use the Tag button in the toolbar
  • use the Tag button in the message header
  • type a number from 1-9 which corresponds to tag as shown in the context menu
  • type 0 to remove all tags

In version 3 you can add a Tag button to the message header (right-click on the header buttons and choose customize). If you don't see a Tag button in your toolbar it might be because you're using a older theme that doesn't support it.

Tags appear to be case insensitive. If you define a "Forum" tag on one PC and a "forum" tag on another PC they're treated as the same tag.

A few other email clients such as Mulberry can recognize Thunderbird tags.

There doesn't appear to be a limit on the number of tags you can create since each one is stored by creating two settings for it in prefs.js rather than setting a bit in a bit mask in a X-Mozilla-Status2 header. Tags are stored differently depending upon whether your using a POP account, a IMAP account, or you moved a message from a remote folder to a local folder.

You normally create or modify a tag using Tools -> Options -> Display -> Tags, but you can also do it by modifying the settings using either the Config editor or by editing prefs.js with a text editor.

Using Tags

View -> Sort by -> Tags can sort the messages in a folder based on the tag. View -> Messages -> Tags can be used to display just the messages with the selected tag. The View list box has a similar menu command but it is not visible in the toolbar in version 2.x. Right click on the toolbar, drag and drop the View control to the toolbar, and press OK to add it. You can also create a custom view using View -> Messages -> Customize that displays just the messages with the desired tags. Using tags with saved searches can be very useful.

Thunderbird in version 2 has limited support for tags in message filters. It just supports set a tag as a action. However, if you add a custom header for the tag, or specify it using "Customize" in the leftmost list box you can test for tags. Since you can have multiple tags for a message its recommended you test whether X-Mozilla-Keys: "contains" a tag rather than using "is". Thunderbird defines tags in prefs.js using two mailnews.tags settings. For example, the following defines a Forum tag with a blue color:

user_pref("mailnews.tags.forum.color", "#3333FF");
user_pref("mailnews.tags.forum.tag", "Forum");

The display color of a tagged message is based on the lowest number tag assigned. If you assign tags number 1 and 5 to a message, the color displayed will be that of tag 1. It doesn't matter whether that color is custom or default.

The Tag tools tweak in the Mail Tweak extension can change the rank of tags and import/export tags if you want to share the definitions.

There is a bug in how tags are stored when a message is moved from a remote folder to a local folder. The information is stored in the .msf file rather than using a X-Mozilla-Keys: header. This means you can't search or filter that tag, and if you delete the .msf file in an attempt to fix a mildly corrupted folder you lose the tag.

Labels versus Tags

Thunderbird before version 2.0 used labels instead of tags. The main difference between labels and tags is that that you can assign multiple tags to a message, and users were limited to five labels due to the way they were stored. If you created labels using an earlier version of Thunderbird they're still stored in the message, they're just ignored. (??? You need to create a custom header to use labels with message filters.)

POP

A X-Mozilla-Keys: header is added to the message to store any tags, if the message was downloaded from a POP account. For example if a message had a Forum and a FYI tag it would be stored as:

X-Mozilla-Keys: forum fyi

IMAP

Thunderbird tries to store tags on the server using IMAP keywords. If the IMAP server doesn't support that it will store lags locally in the .msf file for the folder. That means that another PC can not see the labels.

A quick and dirty way to test where tags are stored would be to exit Thunderbird and delete the .msf file, and see if the tags disappeared. A more sophisticated way is to log into the IMAP account and to check whether the PERMANENTFLAGS server response to the SELECT command contains \* (see RFC 3501).This page explains how to manually connect to an IMAP server.

Thunderbird 1.5.x uses Labels instead of tags but stores them in the same way.

For sharing tags with another PC (or Thunderbird using a different profile) you need to have defined the same tags to see them. Thunderbird appears to have hard coded support for five tags that mimic the old labels. If you use one of those tags on another PC and delete those five tags on your PC you can still see the tags in the remote folder though they will not be colored. It will display the tags in the folder listing but won't list them in the expanded header when you read the message.

Alternatives/Enhancements

The Tag Toolbar extension adds a toolbar with buttons for your tags, plus the ability to filter the tags to be displayed by categorizing tags. It has a "Attach Tags" button in the compose message window that can be used to attach a tag to the outgoing message (not your copy saved in the Sent folder). It uses a X-TagToolbar-Keys: tag to do that so any tag you add that way will not be visible unless the recipient is also using that add-on. [1]

The Tag Dialog add-on also makes it easier to add or create tags. The Sort Tags add-on lets you sort tags, modify their priority and shortcut.

You could use saved searches to automatically sort each tagged message into a different folder. Or omit the tags and have it test the headers to sort messages into the appropriate virtual folder. This isn't restricted to your inbox, like automatically running message filters is.

The TaQuilla add-on uses Bayesian statistics to automatically tag messages. If you don't like the way Thunderbird implements tags you might consider using either the MailClassifier extension or PopFile to automatically scan and classify your messages. The main downside is you need to train it, they use Bayesian filtering to figure out where to move the message.

You can use userChrome.css to also display a colored flag like Outlook has , if you use the default tag colors. [2].

Interoperability

MailTags is a tagging plug-in for Mail.App that's gotten a lot of press, and supports IMAP accounts. Neither Thunderbird or MailTags support each others concept of tags due to differences in how each stores tags. Thunderbird uses IMAP flags while MailTags replaces the message with one where it added the tag using a X-Mailtags header. If you set clear text headers in the MailTags preferences, a search in Thunderbird would find the tag headers but it wouldn't recognize them as tags (they'd just be headers) while MailTags won't find Thunderbirds tags .

External links

  • Bug report about tags for the same account in another profile not being visible until the tag is defined again.
  • Bug report about how tags are stored when moving messages from remote folders to local folders.
  • Bug report about how Rebuild Index can delete tags if the IMAP server doesn't support storing tags as message attributes.
  • Meta bug report to track all tags bug reports.
  • Details of how the X-Mozilla-Status headers are used.

Add-ons

  • Expressions Search tries to make tag searching easier .
  • Prevent Delete prevents deletion of any message that has a certain tag.
  • Sort tags lets you sort tags, modifying their priority and shortcut.
  • TaQuilla sets tags based on a Bayesian analysis of the message content