RealRaven2000 / FiltaQuilla

Adds many new mail filter actions to Thunderbird
http://quickfilters.quickfolders.org/filtaquilla.html
GNU General Public License v3.0
88 stars 17 forks source link

Header Regex Match: Some headers don't work for regex filters #132

Open masscream opened 3 years ago

masscream commented 3 years ago

I have asked this question in https://github.com/RealRaven2000/FiltaQuilla/issues/115 , but probably it was dedicated to another problem...

I am trying to filter out Outlook calendar meetings by content-type "text/calendar" header. However so far I have not been successful. When setting up the filter I tried following options:

content-type:/\b^text\b/
content-type:/\b^text\/calendar\b/

I also tried adding it into mailnews.customDBHeaders in the format:

"content-type".
"content-type"
content-type
Content-Type

But the filter is still ignoring these events. I have found no other info, how to achieve this (except of broken java script). Any ideas? Thanks

RealRaven2000 commented 2 years ago

I also tried adding it into mailnews.customDBHeaders in the format:

"content-type".
"content-type"
content-type
Content-Type

that may not be the right place to add custom headers. You should be able to add it via the uI:

In the conditions column, please select "Customize..."

image

then add the string content-type. (no quote marks)

image

From what I see, this is not added to the config setting mailnews.customDBHeaders - then I would just try the value

content-type:text\/calendar

I don't think you need the word boundary anchor \b as I guess this the full header value in this case.

Minor Edit: I had to add the code property above because otherwise the backslash is being swallowed. Make sure you look at this on github and not just in email.

masscream commented 2 years ago

The option Customize or Custom header works only in case the header is unique in the msg and does not have more occurences. Besides it's not a part of the FiltaQuilla plugin and does not work with RegEx at all (or at least I think). Therefore this is not working, that's why I tried filtering via body RegEx, but this is not working either. The exact phrase I need to match is "Content-Type: text/calendar" or just "text/calendar", however these Header/Body Regex filters are omitting both.

Content-Type: text\/calendar
text\/calendar

edit: I think it would be great to look also in the whole msg source, because as far as the msg can have multiple instances of the one header and/or multiple bodies, it's pretty difficult to say if the msg regex filter should be for header or body. I tested today couple of similar filters but none of them really successfully.

Header Regex:

content-type://i - printed out all msgs
content-type:/multipart.*$/i - none
content-type:/^text.*$/i - none
content-type:/text\/calendar/i - none

Body Regex

/content-type: text\/calendar/i
/^content-type.*$/i
vkovalcik commented 1 year ago

I am not sure Header Regex works at all. Because nothing worked for me, I tried simple tests:

Subject://i - selects all messages Subject:/.*/i - selects all messages Subject:/.+/i - selects NO messages

Is this the expected behavior? Would that mean that the string to be matched is always empty?