What is mail rule headers?

The question is in the subject.

Doesn’t exist mail rule headers, but exist message headers. To view email headers in Apple Mail:

Open the message for which you wish to view headers.
From the menu, select View –> Message –> Raw Source.
The full message is displayed with all headers. You can now select the message header for copying.

Here is one example. Bold words are what you call mail rule headers, but they are message headers. You can simply use some of them (From, To, Subject) in the rule conditions, and that is all:

From: Robert Kniazidis KNIAZIDIS.ROMPERT@gmail.com
Content-Type: text/plain;
charset=us-ascii
Content-Transfer-Encoding: 7bit
Mime-Version: 1.0 (Mac OS X Mail 13.4 (3608.120.23.2.4))
Subject: ubfg-210312-gg-proposal for contract
X-Universally-Unique-Identifier: 04A6E7B9-7D59-43D7-A2DD-110D3577F982
Message-Id: 8B42D539-A005-42F0-9FC5-2EF32189B432@gmail.com
Date: Tue, 23 Mar 2021 21:12:40 +0200
To: Robert Kniazidis kniazidis.rompert@gmail.com

I was talking about these rule headers (highlighted):

Were you too?

It’s a field that’s invisible to the end user in the real world, and it appears largely inert with limited utility. Were you to explicitly set it, you could filter for it:

[format]rule 1’s rule conditions whose its header is “WHATEVER YOU NAMED IT”
[/format]

It is not mail rule header but rule condition’s header key. The Mail.app has by default 4 message headers for conditions: From, To, Cc, Subject.

But as you can see, the message headers are > 4. The header key of rule condition gives you possibility to add the rest message headers to condition (Content-Type, Content-Transfer-Encoding, Mime-Version, X-Universally-Unique-Identifier, Message-Id, Date).

First, run this in the Script Debugger:

tell application "Mail" to rules

Now, open some existing condition of some existing rule to see its properties. Then, change manually value of header property from “” to “Message_Id”, then run script above again. Your Mail.app now remeber and knows 1 additional message header: Message_Id, and you can use it as well as 4 default headers of Mail.app. You can continue the same way and add rest headers as well.

Other manual way is: go Mail–>Preferences–>Rules–>Edit some certain rule–>Open popup menu–>Edit header list, add some message header name, which isn’t already in the list

Are you implying that the rule condition’s “header” property denotes the extended set of Mail message headers? According to Marc Anthony these are arbitrary words. I’m confused.

Yes. Logically it is true, but I never tested this logical conclusion.