0

我有过滤器

require ["envelope", "variables", "vnd.dovecot.pipe"];

if envelope :matches "To" "user@example.com" {
  set "recipient" "${0}";

  if header :matches "From" "*" {set "sender" "${0}";}
  if header :matches "Date" "*" { set "date" "${0}"; }
  if header :matches "Content-Type" "*" { set "content_type" "${0}"; }
  if header :matches "Subject" "*" { set "subject" "${0}"; }
  if header :matches "Message-ID" "*" { set "message_id" "${0}"; }


  pipe "forwarding_cimp.sh" ["message_id:${message_id} date:${date} content_type:${content_type} sender:${sender} recipient:${recipient} subject:${subject} body:${body} body2:${body2}"];
}

如何使用电子邮件原始文本设置变量

if body :content "text" :matches "*" {set "body_text" "${0}"; # 不工作}

如果正文 :raw :contains "*" {set "raw_text" "${0}"; # 也不起作用} 如何获取电子邮件原始文本

4

1 回答 1

0

我认为您正在寻找extracttext扩展名,请参阅rfc5703

require "extracttext";
require "foreverypart";
require "mime";
require "variables";

set "body" "";
foreverypart {
    if header :mime :type :is "Content-Type" "text" {
        extracttext "content";
        set "body" "${body}${content}";
    }
}
于 2022-03-03T09:59:17.867 回答