Exim:根据密件抄送的收件人转发

发布于 2024-12-14 21:48:35 字数 1725 浏览 2 评论 0原文

目前,我通过 .forward 按以下方式过滤传入邮件:

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

所以我有一个邮件帐户,它接收不同地址的邮件。基本上我希望它们根据邮件发送到的地址降落在不同的子目录中。

这适用于收件人位于 to 标头中的邮件,但如果收件人位于 bcc 中则不起作用。

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

Envelope-to: [email protected]

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 <[email protected]>)
    id 1RO5xc-0001TF-Qj
    for [email protected]; Wed, 09 Nov 2011 12:04:57 +0100
...
To: [email protected]

我已经尝试过:

if $header_envelope-to: matches ...

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

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

Currently I am filtering incoming mails by a .forward in the following way:

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

So I have a mail account, which receives mails for different addresses. Basically I want them to land in different subdirs based on the address the mail was sent to.

This works for mails where the recipient is in the to-header, but does not work if the recipient was in the bcc.

When a mail is received which was sent with the bcc-header, only the envelope-to-header matches the real address the mail is delivered to and it is mentioned in a Received-header

Envelope-to: [email protected]

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 <[email protected]>)
    id 1RO5xc-0001TF-Qj
    for [email protected]; Wed, 09 Nov 2011 12:04:57 +0100
...
To: [email protected]

I already tried:

if $header_envelope-to: matches ...

but this does not work, mails are not filtered at all even when sent with To-header (looks like the Envelope-To-header is not available in forward-files). Should I try to parse the (multiple) Received-headers?

How can I move mails into a subdir of the recipient based on the real recipient address?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

鸩远一方 2024-12-21 21:48:35

看来我终于找到了答案。

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

这仅检查 local_part,但 afaik 也可以扩展为使用该域,通过 $original_domain (参见 文档

looks like I finally found the answer.

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

This checks only the local_part, but afaik could be extended to use the domain, too, with $original_domain (see the doc)

韵柒 2024-12-21 21:48:35

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

The variable $recipients contains all (to, cc and bcc) recipients. Have you tried it?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文