networkException / thundersort

Sort incoming mails based on recipient slug
https://addons.thunderbird.net/en-US/thunderbird/addon/thundersort/
BSD 2-Clause "Simplified" License
5 stars 2 forks source link

reworked getRecipient to support multiple recipients #5

Closed LeMoonStar closed 2 years ago

LeMoonStar commented 2 years ago

The current getRecipient function only supports finding the first recipient. As an email can have multiple recipients, it should find all of them. Additionally, using Thunderbird's pre-parsed attributes of the MessageHeader object makes the code much more straightforward.

The new getRecipients function doesn't filter for the domain, allowing more freedom in the pattern matching. This also avoids having to set the account name to the domain. However, using a wildcard for the domain in the pattern matching will result in the Sort function matching the first recipient it finds no matter the domain, which might not be desirable.

As this change introduces support for Cc and Bcc, it resolves #3.

networkException commented 2 years ago

I think this is basically good to merge. I will look into a way to limit the mail domains that get matched by scanning the registered account identities on first launch and allowing a user to modify that list

networkException commented 2 years ago

I'm also thinking of simply including some non standard headers like x-github-recipient-address. We can iterate on getting possible recipients from more headers later

LeMoonStar commented 2 years ago

I'm also thinking of simply including some non standard headers like x-github-recipient-address. We can iterate on getting possible recipients from more headers later

Including non-standard headers is a good idea, however, I believe they should be part of a separate commit/PR.