The common folders to be taken into account can be selected in the options panel of the add-on. Pre-selected are the folders: spam, trash, drafts and templates.
In the options panel it is configurable whether messages in subfolders should also be marked as read or whether subfolders should be left as they are.
Why might this extension be useful?
IMAP mail providers like gmx automatically move emails to the spam folder, and those emails remain there with the status "unread". Thunderbird displays the accumulated number of ALL unread emails for an account next to the account name. But unread emails, e.g. in the spam folder, are not relevant to most users. It may therefore make sense to automatically mark all emails in the spam folder as "read".
I use this add-on myself, and therefore it will remain compatible with future Thunderbird versions.
The onFolderInfoChanged event is listened to. Unread emails in the affected folder are determined and their status is set to "read".
The folders to which the functionality is applied are selectable (configurable) in the options panel of the add-on.
To test the functionality, an email in a configured folder (e.g. spam folder) can be marked as unread using the context menu. A very short moment later, this email is automatically marked as read by this add-on.
I think the functionality should be compatible with other addons.
The source code is on Github.
I am grateful for comments, hints and suggestions.
It was a pleasure developing this little add-on and I would be happy if someone finds it useful.