【问题标题】:Exim: Forward Based on Recipient in bccExim:转发基于密件抄送中的收件人
【发布时间】:2011-12-25 06:04:37
【问题描述】:

目前我正在通过 .forward 以下列方式过滤传入的邮件:

if $header_to: matches "(office|info)@domain.com" then
    save Maildir/.office/
endif
if $header_to: matches "whatever@domain.com" then
    save Maildir/.whatever/
endif

所以我有一个邮件帐户,可以接收不同地址的邮件。基本上我希望他们根据邮件发送到的地址进入不同的子目录。

这适用于收件人在to-header 中的邮件,但如果收件人在bcc 中则不起作用。

当收到使用bcc-header 发送的邮件时,只有envelope-to-header 与邮件发送到的真实地址匹配,并且在Received-header 中提及

Envelope-to: office@domain.com

Received: from mail.other.domain ([1.1.1.1])
    by mail.domain.com with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
    (Exim 4.71)
    (envelope-from <sender@other.domain>)
    id 1RO5xc-0001TF-Qj
    for office@domain.com; Wed, 09 Nov 2011 12:04:57 +0100
...
To: can_be_anything@whatever.com

我已经试过了:

if $header_envelope-to: matches ...

但这不起作用,即使使用To-header 发送邮件也不会被过滤(看起来Envelope-To-header 在转发文件中不可用)。我应该尝试解析(多个)Received-headers 吗?

如何根据真实收件人地址将邮件移动到收件人的子目录中?

【问题讨论】:

    标签: email filter exim bcc exim4


    【解决方案1】:

    变量$recipients 包含所有(toccbcc)收件人。你试过了吗?

    【讨论】:

      【解决方案2】:

      看来我终于找到了答案。

      if $original_local_part matches "office|info" then
          save Maildir/.office/
      endif
      

      这仅检查 local_part,但 afaik 也可以通过 $original_domain 扩展以使用域(请参阅 the doc

      【讨论】:

        猜你喜欢
        • 2015-12-19
        • 2013-12-22
        • 2015-10-10
        • 2012-04-10
        • 2010-10-13
        • 2012-12-23
        • 2014-05-23
        • 2014-12-27
        • 1970-01-01
        相关资源
        最近更新 更多