My need is to have an enhanced filter for the spams. Ex. if the title or mail contains "xxxxxx" and "yyyyy" OR "ZZZZZZ" it is automatically transferred to the trash bin.
I am not sure I understand the purpose of your idea. Thunderbird has a "learning spam filtering function based on Bayesian theory" that has been well established since the beginning.
Cutting Out the Junk Thunderbird’s popular junk mail tools have been updated to stay ahead of spam. Each email you receive passes through Thunderbird’s leading-edge junk mail filters. Each time you mark messages as spam, Thunderbird "learns" and improves its filtering so you can spend more time reading the mail that matters. Thunderbird can also use your mail provider’s spam filters to keep junk mail out of your inbox.
As stated, the learning spam filter based on Bayesian theory improves its accuracy the more it is used, and is effective in reducing the amount of work required to process spam.
Another nice feature is the "Phishing Scam Alert.
Thunderbird Settings > Privacy & Security > Junk Account Settings > Junk Settings Spam filters of "Bogofilter/DSPAM/POPFile/SpamAssassin/SpamPal" can be selected.