Message Filters: Difference between revisions

From MozillaZine Knowledge Base
Jump to navigationJump to search
Line 4: Line 4:
[http://opensourcearticles.com/thunderbird_15/english/part_07 This 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...."
[http://opensourcearticles.com/thunderbird_15/english/part_07 This 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''—beginning with Thunderbird 1.5—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.  
'''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.
(For Thunderbird 1.0.x: Filters for Local Folders will ''not'' be applied automatically to incoming mail; they must run manually. You can, however, create filters for any specific account that uses the Global Inbox, and these account-specific filters will operate automatically on incoming mail.)


==Running filters==
==Running filters==

Revision as of 02:09, 27 January 2007

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.

Creating filters

This 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.

Running filters

Filters 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.

Filtering the message body

You 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. However, most 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. If you have multiple IMAP accounts you only need to add the custom header once, any custom headers affect all accounts.

Unfortunately, the support for custom headers is version dependent. In version 1.5.0.7 you need to use "Body:" (add a colon to the custom header), many older versions accept both formats, while in 1.5.0.8 it complains about a invalid character if you enter "Body:" in the GUI but has no problem using "Body:" if you added it using a text editor. You need to experiment, and may not be able to get it to work (there are a lot of bug reports about it).

Other information

  • The file that stores your filter settings in called "msgFilterRules.dat". Each account will have its own "msgFilterRules.dat" file, stored in the account subfolder in the "Mail" or "ImapMail" folder in your profile folder. (In the case of filters for Local Folders, "msgFilterRules.dat" will be found inside the "Local Folders" folder itself.)
  • If you want to duplicate filters from one account to another without manually recreating each individual filter, you can copy "msgFilterRules.dat" from one account subfolder to another. Also note that if you filter based on custom headers you will need to copy the user_pref("mailnews.customHeaders","") line from the prefs.js file in the other profile into your new one.
  • To enable and view your filtered messages log, follow "Tools -> Message Filters," select "Filter Log," and check the box for "Enable the Filter Log." Then use the mouse to 'grab' any corner and stretch it open till it expands. The area where any log data is will show once a filter has been run. If you can't view your filter log for some reason look in the "filterlog.html" file in that accounts subfolder in the profile.
  • There is no support for regular expressions or wild cards.
  • If you want one or more actions to always occur, test whether the subject matches a string that you're unlikely to ever see such as %#!*&;2Q~! .
  • If your email provider supports IMAP see if they support server side filtering or the Sieve mail filtering language. That may provide more functionality, and any filtering would take place before the mail server stores the message.

See also