為了改善您的使用體驗,本網站正在進行維護,部分功能暫時無法使用。若本站的文件無法解決您的問題,想要向社群發問的話,請到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 發問,我們的社群成員將很快會回覆您的疑問。

搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

了解更多

How can I maintain one set of TB filter rules for all of my accounts?

  • 1 回覆
  • 0 有這個問題
  • 1 次檢視
  • 最近回覆由 Airwolf

more options

I maintain multiple email accounts for which I want to run the same filter rules. I mean the *same* rules. Unlike some people in this predicament, I am never moving emails within a folder hierarchy that is only the same as others relative to each account. When I move any particular type of filtered email, those particular messages all go to a folder in a single account, even if they originate in a different account. So, I really do want to run the *same* rules for each account, where each rule will send mails to a single folder. Mind you, though, not each filter that moves a message has to have the same destination account. One filter rule can send all emails to a folder under one account, another filter rule can send emails to a folder under a different account.

Note that I am going to answer my own question. I am doing this because I have seen people troubled by this problem and yet none has received the novel advice I have used to conveniently solve my own problem. All of the questions and answers have also been archived by now, so I cannot offer my novel solution in response to those question. Thus, I am asking the question for myself so I can then share the results with others.

I maintain multiple email accounts for which I want to run the same filter rules. I mean the *same* rules. Unlike some people in this predicament, I am never moving emails within a folder hierarchy that is only the same as others relative to each account. When I move any particular type of filtered email, those particular messages all go to a folder in a single account, even if they originate in a different account. So, I really do want to run the *same* rules for each account, where each rule will send mails to a single folder. Mind you, though, not each filter that moves a message has to have the same destination account. One filter rule can send all emails to a folder under one account, another filter rule can send emails to a folder under a different account. Note that I am going to answer my own question. I am doing this because I have seen people troubled by this problem and yet none has received the novel advice I have used to conveniently solve my own problem. All of the questions and answers have also been archived by now, so I cannot offer my novel solution in response to those question. Thus, I am asking the question for myself so I can then share the results with others.

所有回覆 (1)

more options

The solution for this is to create a complete set of filters for just one account. Since these rules are stored in a file located in a folder unique to that account, all you need to is create "hard links" of the filter file in the other account folders. You only need to do this once for each account, never again, unless you start using different rules for different accounts.

Here is how to make the hard links.

1. Shut down Thunderbird. Close all TB windows. Make sure you don't have any others open, like alerts or messages you were composing! You can also check Task Manager to see that TB has no processes running.

2. Identify the TB folder for your current profile. For example, in Windows 10, you could expect the folder name to be "C:\Users\<username>\AppData\Roaming\Thunderbird\Profiles\<8-digit random code>.default". If you have more than one folder with a random 8-digit code, choose the folder with the latest modification time (unless you think you modified another profile folder even more recently).

3. Within that folder you just identified, there are sub-folders related to each mail account you have setup in TB (for that profile). Identify the account folder for your one email account that has all of (and the only) rules you want to share with other accounts.

Generally, Windows 10 users would find that folder in "C:\Users\<username>\AppData\Roaming\Thunderbird\Profiles\<8-digit random code>.default\ImapMail\<vendor incoming mail server URL>.

For example, if you had just setup your rules for a Yahoo IMAP account in Windows 10, you could expect to see a folder name like "C:\Users\YourUserName\AppData\Roaming\Thunderbird\Profiles\4b3oc8e9.default\ImapMail\imap.mail.yahoo.com".

4. Identify all of the other folders in your profile that contain your accounts to which you want to apply the same filter rules. For example, if you have a Google account it could be something like "C:\Users\YourUserName\AppData\Roaming\Thunderbird\Profiles\4b3oc8e9.default\ImapMail\imap.gmail.com".

5. **For each of mail account folders you will be sharing those rules with,** delete the msgFilterRules.dat file (or rename it to something like msgFilterRules.dat.bak). (Do NOT do delete the file in the folder which has all the filter rules you want to propagate!)

6. After you have deleted or renamed all of the filter rule files in other account folders, you will create the hard links.

a. Open a Windows command prompt window as administrator (or for another OS, do an equivalent shell operation).

b. Change your directory to the folder with the original "good" filter file (with all the rules you use). For example, "cd C:\Users\<username>\AppData\Roaming\Thunderbird\Profiles\<8-digit random code>.default\ImapMail\<vendor incoming mail server URL>"

c. Make a **hard link** (not just a "shortcut" or "soft/symbolic link") to each additional account folder using the current folder's msgFilterRules.dat file. Use the mklink command with the "h" (for hard) option: "mklink -h ../<additional vendor incoming mail server URL>/msgFilterRule.dat msgFilterRule.dat" {doing this for each additional account needing the same filter rules} E.g., for making a hard link to a Google account from a Yahoo account, it would be "mklink -h ../imap.google.com/msgFilterRule.dat msgFilterRule.dat"

7. Once you have made all the hard links for each account sharing the rules, you will essentially have a single collection of rules to which each account is pointing. Hard links were designed for needs like this! In many similar situations, you could also use soft links, but Thunderbird (for reasons I don't know of) requires hard links.

8. Restart Thunderbird and enjoy the simplicity of the same filter rules shared by multiple accounts.

Note: Every solution I have previously seen offered for this problem has involved making a copy of the original filter file in each additional account folder (or editing the msgFilterRules.dat file and pasting in the rules from another file). However, that solution requires recopying the filter rules file to each account directory **every time the filter rules have changed**. That requirement is an invitation for making mistakes, including forgetting to copy the files after a filter change or only copying the files to certain accounts. I hope this has helped someone, someday. :-)