Which of multiple headers in a message does a Thunderbird filter property check?
I am making filters which have a property based on a `X-Original-To`, a header of the email message. It is straightforward to create a Thunderbird message filter on the value of this header (e.g. take action when `X-Original-To` header begins with 'list+'). However, the behaviour of the filter is confusing when the message has multiple `X-Original-To` headers. I can't find anything which tells whether Thunderbird applies the filter to the first matching header, or to the last, or any arbitrary-chosen matching header, or what.
The `X-Original-To` header is not built in to the Thunderbird UI, but I think that is not material. Most email messages I have seen have multiple `Received` headers. How does a Thunderbird message filter property testing the `Received` header behave?
I expect there to be documentation stating what correct behaviour of a Thunderbird filter is. I cannot find such documentation. In fact the only documentation on filters I have found is "Organize Your Messages by Using Filters" (https://support.mozilla.org/en-US/kb/organize-your-messages-using-filters). Is there documentation I am missing?
From observation, I suspect that Thunderbird applies the filter property only to the final occurrence of a header in a message, and ignores any previous occurrences of that header in that message. The insight here is, if a filter property on a message header just _is not_ behaving as expected, check if your message has multiple occurrence of that header, and if you are seeing only the first one. Maybe the filter property is in fact operating as expected, but on the final occurrence.
Is there any Thunderbird UI to control which of multiple occurrences a filter property checks? Is there a way to make it check the first occurrence, instead of the last?
When my filter misbehaves, I do not see an entry in the Filter Log describing how that fllter tested against that message. The Filter Log only seems to get messages when a filter property matches against a message. This is unhelpful when diagnosing a problem of a filter _not_ matching. I expect log entries for failed matches also, though I recognise that would get very verbose very quickly. A message when a filter finds multiple occurrences of a header it is testing would be very helpful. Is there a way to make the Filter Log describe failed matches?
My primary questions are, which of multiple headers in a message does a Thunderbird filter property check? Where should a Thunderbird user discover this answer when setting up their filters?
Additional System Details
- User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:69.0) Gecko/20100101 Firefox/69.0
Filters act on the first instance they encounter has been my observation. So reading from the tops. the first you come to will be the one used.
@Matt, thank you for your observation. My observation, at least with checking for the `X-Original-To` header, is opposite. Thus we have conflicting observations, and a greater need for a clearer statement of which header Thunderbird is supposed to check in filter properties.
Perhaps you could tell me
Thank you for the tip! I had a quick read through nsMsgSearchTerm.cpp, and I couldn't find an answer to the question of which of multiple headers does Thunderbird read. Seeing the answer probably requires being more familiar with the codebase overall. The answer might lie in a different module, for instance in the implementation of nsIMsgDBHdr::get().
You are probably correct, I get out of my depth fairly quickly with the style of C++ used in Thunderbird.