Exim:根据密件抄送的收件人转发
目前,我通过 .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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看来我终于找到了答案。
这仅检查 local_part,但 afaik 也可以扩展为使用该域,通过
$original_domain
(参见 文档)looks like I finally found the answer.
This checks only the local_part, but afaik could be extended to use the domain, too, with
$original_domain
(see the doc)变量
$recipients
包含所有(to
、cc
和bcc
)收件人。你尝试过吗?The variable
$recipients
contains all (to
,cc
andbcc
) recipients. Have you tried it?