n.s*_*.st 3 email sieve-rules sieve
我订阅了一个邮件列表,该列表没有在通过列表发送的邮件主题中标识自己。
我希望将列表邮件发送到我的主收件箱,但仍然能够在乍一看时将它们识别为来自列表。
我的 MTA (Dovecot) 支持带有大多数常用扩展名的Sieve 过滤器。
如何在此列表中的邮件前添加“[Foo-List]”标签?
似乎没有标准化的方法可以直接在邮件的主题标头中添加或附加字符串,但有一种使用editheaders和variables扩展名的解决方法:
require "editheader";
require "variables";
# Match/select your message as you see fit
if header :contains "List-Id" ["<foo.lists.example.net>"]
{
# Match the entire subject ...
if header :matches "Subject" "*" {
# ... to get it in a match group that can then be stored in a variable:
set "subject" "${1}";
}
# We can't "replace" a header, but we can delete (all instances of) it and
# re-add (a single instance of) it:
deleteheader "Subject";
# Append/prepend as you see fit
addheader :last "Subject" "[Foo-List] ${subject}";
# Note that the header is added ":last" (so it won't appear before possible
# "Received" headers).
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1087 次 |
| 最近记录: |