代码之家  ›  专栏  ›  技术社区  ›  JackTheKnife

Dovecot筛选和:用于执行的输出变量

  •  0
  • JackTheKnife  · 技术社区  · 7 年前

    我想让吹筛过滤器工作

    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并根据电子邮件地址验证用户,然后返回布尔值(作为控制台的输出)。

    我搬的时候一切都很好 if string :matches "${valid_user}" "True" 另一种说法是不认识 valid_user 变量。

    当我管 验证用户 对于某些脚本,为了捕获该变量的值,它会引发一个错误:

    错误:指定:args item`true?'无效。

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

    思想?

    1 回复  |  直到 7 年前
        1
  •  0
  •   JackTheKnife    7 年前

    在这种情况下,“true”后面是一个换行符,它可以很好地筛选读值并包含在变量值中。

    把它修好 user-verification 脚本必须在没有新行的情况下输出它。

    推荐文章