我正在尝试使吹筛过滤器工作
require ["fileinto", "imap4flags", "mailbox", "body", "envelope", "vnd.dovecot.pipe", "variables", "vnd.dovecot.execute"];
if envelope :matches "To" "*@*" {
set "recipient" "${0}";
set "user" "${1}";
set "recip_domain" "${2}";
}
if envelope :matches "From" "*" {
set "sender" "${0}";
}
#Check if recipient is valid user
if execute :output "valid_user" "user-verification" "${recipient}" {
if string :matches "${valid_user}" "True" {
if body :raw :contains ["message/notification"] {
setflag "\\Seen";
fileinto :create "Notifications";
stop;
}
}
}
user-verification
是一个extprogram,它调用API并根据电子邮件地址验证用户,然后返回boolean(作为对控制台的输出)。
当我将if string :matches "${valid_user}" "True"
声明以其他方式无法识别valid_user
变量时,一切正常。
当我通过管道将valid_user
传递到某个脚本以捕获该变量的值时,会引发错误:
错误:指定了:args项目'True?'无效。
为什么在这种情况下将问号添加到变量中?
有想法吗?
答案 0 :(得分:0)
在这种情况下,“ True”后跟换行符,Sieve乐于读取并包含在变量值中。
要修复此问题,user-verification
脚本必须在不换行的情况下输出。