0

我需要检索消息的某些部分,看起来像

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" "${0}";
}

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

4

1 回答 1

0

发现身体测试肯定不适用于匹配变量:

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

与“body”一起使用的通配符表达式不受 [VARIABLES] 中描述的副作用的影响。也就是说,它们不得将匹配变量(${1}、${2}...)设置为与匹配模式中的通配符序列对应的输入值。

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

于 2018-09-21T19:46:25.703 回答