有没有办法将变量设置为 Sieve 中的字符串列表?
Is there a way to set a variable to a list of strings in Sieve?
我想像这样写一个 Sieve 过滤器:
require "fileinto";
require "imap4flags";
require "variables";
set "adresses" ["foo.com", "bar.com", "baz.com"];
if address :domain ["to", "from"] ${addresses} {
addflag "\Seen";
fileinto "Spam";
}
问题是,RFC 和实现(ProtonMail 的)都只允许字符串:
Usage: set [MODIFIER] <name: string> <value: string>
是否有任何适当的或 hacky 的方法仍然可以做类似的事情?
您可以使用带有 :
等分隔符的 pseudo-array 字符串,这显然不是域名的一部分。
require "variables";
set "addresses" ":foo.com:bar.com:baz.com:";
if address :domain :matches "to" "*" { set "domain_to" ""; }
if address :domain :matches "from" "*" { set "domain_from" ""; }
if string :contains "${addresses}" [":${domain_to}:", ":${domain_from}:"] {
addflag "\Seen";
fileinto "Spam";
}
我想像这样写一个 Sieve 过滤器:
require "fileinto";
require "imap4flags";
require "variables";
set "adresses" ["foo.com", "bar.com", "baz.com"];
if address :domain ["to", "from"] ${addresses} {
addflag "\Seen";
fileinto "Spam";
}
问题是,RFC 和实现(ProtonMail 的)都只允许字符串:
Usage: set [MODIFIER] <name: string> <value: string>
是否有任何适当的或 hacky 的方法仍然可以做类似的事情?
您可以使用带有 :
等分隔符的 pseudo-array 字符串,这显然不是域名的一部分。
require "variables";
set "addresses" ":foo.com:bar.com:baz.com:";
if address :domain :matches "to" "*" { set "domain_to" ""; }
if address :domain :matches "from" "*" { set "domain_from" ""; }
if string :contains "${addresses}" [":${domain_to}:", ":${domain_from}:"] {
addflag "\Seen";
fileinto "Spam";
}