Message FiltersFrom MozillaZine Knowledge Base(Redirected from Thunderbird : FAQs : Filters)
Message filters are useful if you routinely want to perform certain actions on messages, according to criteria that you've specified. For instance, you can have incoming mail automatically sorted into different folders, with certain messages labelled, marked as Junk, or even deleted. Filters can be applied automatically to incoming mail, or you can run them manually when desired.
[edit] Creating filtersThis tutorial has clear, step-by-step instructions (with screenshots) for how to set up message filters in Thunderbird. You can also create a new filter from any message by right-clicking on the hyperlinked email address of the sender, where it appears above the message pane, and choosing "Create Filter From Message...." Important: filters must be set up on a per-account basis, and they likewise operate on a per-account basis. There is not currently any option to create "global filters" that will operate on all accounts 'except in the case of multiple POP accounts using the Global Inbox. In this case, you can create filters for Local Folders that will be applied automatically to incoming mail for all those accounts. [edit] Running filtersFilters that are enabled will be run automatically, in the order in which they are listed in the "Message Filters" dialog ("Tools -> Message Filters..."). Note that if you set up a filter to move an incoming message to a specified folder, subsequent filters will not be automatically applied to that message once it has been moved from the Inbox. There is currently no option to have filters be applied automatically to outgoing mail. To run filters manually on the currently opened folder, select "Tools -> Run Filters on Folder". To manually run only some of your filters rather than all of them, go to "Tools -> Message Filters...", select the filters you want to run, and click the "Run Now" button. [edit] Filtering the message bodyYou can filter based on the contents of a message body in a POP account if you select "Body". This will also search attachments, though its not clear if thats formally supported. In Thunderbird 1.5 filtering the message body may not work if you have enabled the feature for quarantining individual incoming messages. [1] By default, Thunderbird doesn't support filtering the message body in a IMAP account. There is no "Body" in the list box. Older versions of Thunderbird will let you filter the message body in a IMAP account if you add "Body" as a custom header . Either create a new filter or edit a existing filter and select "customize" in the left most list box. Enter "Body" as the "new message header". This adds user_pref("mailnews.customHeaders", "Body");' to prefs.js. Unfortunately, this feature doesn't work with recent versions. The developers explanation that its too hard to do because it would require downloading and storing the the message bodies before applying filters doesn't address the issue of why it used to work for many versions. [edit] Filtering based on TagsThunderbird doesn't have explicit support for filtering by tags but you can select Custom Headers from the leftmost list box while editing the filter rule and add support for X-Mozilla-Keys, and then test whether it "contains" that tag. Thunderbird uses that header to store tags. For example, X-Mozilla-Keys: forum fyi indicates the message has the forum and fyi tags. IMAP accounts store tags using message attributes instead, so its not possible to do that with messages stored in remote folders. If you copy the message to a local folder it currently doesn't add a X-Mozilla-Keys header with the tags, though it will add a empty X-Mozilla-Keys header when you compact it. [2] [edit] SpamWhile you can create message filters to test for Spam thats re-inventing the wheel. Its more efficient to use the junk mail controls . This article explains how to tweak the the junk mail controls to make them learn faster. You could also run other tools such as SpamAssassin or SpamPal that add headers to describe its analysis of the message and some sort of spam score that you can test. For example, SpamPal adds a X-SpamPal: PASS header if the message isn't spam. When you check for new mail message filters are run before the junk mail controls. There is no way to change that order. [edit] Account specific filtersEach account has its own set of message filters, but they normally have no concept of accounts. You can create account specific message filters by checking the value of the X-Account-Key header. Use View -> Message Source and find the header, noting what its set to. For example, X-Account-Key: account10. Then create a message filter and scroll the leftmost list box (it defaults to Subject) down to Customize. Enter X-Account-key as the new message header, and press OK. Select X-Account-Key in that list box and test whether "X-Account-Key" "is" "account10" (replace account10 with the value your account uses) and select in "Perform these actions" what it should do. If the filter doesn't work see if Thunderbird changed the header it tests to Subject behind your back. Sometimes you run into a temporary glitch after adding a customized header. If that happens, exit Thunderbird, restart it , and edit the message filter to use X-Account-Key. [edit] Troubleshooting
If you have never written a message filter before and can't figure out what is wrong, try starting smaller and working your way up. For example, you might have written a filter to move certain new messages to a different folder and it doesn't seem to do anything. Modify the message filter to make it add a star to all new messages. That is something harmless you can see and easily undo manually. If that works then modify it to add the star only for those messages that you want to move to a folder. If that works then modify it to move the messages instead of adding a star. The reason for doing this is by starting small its easier to catch and debug common errors, or identify if there is something wrong with that account that prevents any message filter from working etc. You could create a message filter that adds a star to all messages by testing whether the "Subject" "isn't" "~!@#$%^&*()_+i" (or some other extremely unlikely string) and selecting "Add Star" in the actions list box. Test it using "Tools -> Run Filters on Folder". If no matter what you do it doesn't work, try replacing the contents of the "msgFilterRules.dat" file for your account in the profile as follows. If that doesn't work you probably choose the wrong account directory. version="8" logging="yes" name="Apply a star to all messages" enabled="yes" type="1" action="Mark flagged" condition="OR (subject,isn't,\"~!@#$%^&*()_+i\")" [edit] Other information
[edit] See also
[edit] External links
|
|