[Users] Filter->Condition: test for missing Date header?
wwp
wwp at claws-mail.org
Tue Mar 25 13:29:13 UTC 2025
Hello Pierre,
On Mon, 24 Mar 2025 19:54:27 -0400 Pierre Fortin via Users <users at lists.claws-mail.org> wrote:
> On Tue, 25 Mar 2025 00:40:02 +0100 wwp wrote:
>
> >On Mon, 24 Mar 2025 19:22:30 -0400 Pierre Fortin via Users <users at lists.claws-mail.org> wrote:
> >
> >[snip]
> >> Didn't have to wait long for one of these messages.
> >> However, this rule didn't trigger; so I opened the Filter Log, cleared
> >> it, and manually filtered which gave:
> >> [2025-03-24 19:08:36] filtering message (manually)
> >> message file: /home/pfortin/Mail.pfortin/inbox/72296
> >> Date: (null)
> >> From: 楽天証券からのお知らせ <supportcontact at glaq.com>
> >> To: pfortin at pfortin.com
> >> Subject: 【楽天証券】株式取引手数料最大50%OFF!期間限定スペシャルオファー
> >> [2025-03-24 19:08:36] processing rule 'No Date' [ ~header "Date" regexpcase "." color 2 ]
> >> > rule is not account-based
> >> [2025-03-24 19:08:36] checking if message matches [ ~header "Date" regexpcase "." ]
> >> > message does not match
> >>
> >> Also tried: header "Date" regexpcase "." (contains)
> >>
> >> So it appears there's no way to check for a missing header...
> >>
> >> I suspect the "juice ain't worth the squeeze" to add Header "is missing" as a 3rd choice to "contains"/"doesn't contain".
> >
> >I also thought of: ~headers_part regexp "^Date: ", but it's maybe too
> >late this evening for me to think clearly :-/.
>
> Clearly enough!! :)
>
> Looks like a hidden feature as I couldn't find a way to set this up with
> the GUI; so I edited the rule directly and success!
>
> [2025-03-24 19:50:23] filtering message (manually)
[snip[
> > message matches
>
> THANKS!!!
You're very welcome, Pierre.
Not at all a hidden feature:
1. /Configuration/Filtering...
2. Click the Define... button to the right of Condition
3. (change the match criteria first)
Match criteria: [Phrase] in [headers part]
Headers part [doesn't contain] [^Date: ]
[x] Use regexp
4. Click the Add button
5. end up with:
Condition [~headers_part regexpcase "^Date: "]
I guess the 'Phrase' match criteria is not that obvious, it's often the
last resort and may possibly be a performance penalty (when used to
parse email body for instance).
Regards,
--
wwp
https://useplaintext.email/
More information about the Users
mailing list