Dovecot Sieve - 如何将消息的一部分作为变量检索

Dovecot Sieve - How to retrieve part of message as a variable

我需要检索看起来像

的消息的某些部分
Subject: Test message
Message-Id: <2788db2f-b5c3-4b8c-881e-362c3df4f915@server.local>
Mime-Version: 1.0
Content-Type: multipart/report; boundary="----=_Part_fba0c199dfcd4d60ae506b37a6320a84"; report-type=notification
To: adam@test.local
Date: Mon, 17 Sep 2018 16:21:45 -0400 (EDT)
From: postmaster@server.local


------=_Part_fba0c199dfcd4d60ae506b37a6320a84
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

BTW, this is the correct notification ... it should be "failed" not "failure".
------=_Part_fba0c199dfcd4d60ae506b37a6320a84
Content-Type: message/notification
Content-Transfer-Encoding: 7bit

Final-Recipient: rfc822; eve@test.local
Original-Message-ID: <06dbfc12-57a5-49bd-84bd-a24bc3ba1e42@fake.cernerasp>

------=_Part_fba0c199dfcd4d60ae506b37a6320a84—

例如,我需要获取 Final-Recipient: rfc822;Original-Message-ID: 之后的内容并将它们存储为变量

我试过

if body :raw :contains ["Original-Message-ID:"] {
  set "Original-Message-ID" "[=11=]";
}

但是设置为 Original-Message-ID 的变量不包含消息中它后面的内容。

想到body test肯定不会用match variables:

https://www.rfc-editor.org/rfc/rfc5173#section-6

Wildcard expressions used with "body" are exempt from the side effects described in [VARIABLES]. That is, they MUST NOT set match variables (, ...) to the input values corresponding to wildcard sequences in the matched pattern.

MIME Sieve 扩展可能会提供所需的内容 https://www.rfc-editor.org/rfc/rfc5703pipe 将消息发送到脚本并在那里进行处理,这是我在我的案例中所做的。