0

我正在尝试让吹筛过滤器工作

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;
      }
    }
}

extprogram在哪里user-verification调用 API 并根据电子邮件地址验证用户,然后返回布尔值(作为控制台的输出)。

if string :matches "${valid_user}" "True"当我以其他看起来无法识别valid_user变量的方式删除语句时,一切正常。

当我通过管道valid_user传输到某个脚本只是为了捕获该变量的值时,它会引发错误:

错误:指定:args 项目“真?” 是无效的。

为什么在这种情况下将问号添加到变量中?

想法?

4

1 回答 1

0

在这种情况下,“True”后面是一个换行符,Sieve 很高兴地读取它并将其包含在变量值中。

要让它固定user-verification脚本必须在没有新行的情况下输出它。

于 2018-09-21T19:56:28.557 回答