我创建了一个筛选脚本,可以过滤主题中的特定单词,删除正文并向收件人和发件人发送通知。
一切运行良好,但我唯一无法弄清楚的是如何更改回复电子邮件,使其不来自 POSTMASTER。
我已将 /etc/dovecot/conf.d 中的 15-lda.conf 更改
#Address to use when sending rejection mails.
#Default is no-reply@%d. %d expands to recipient domain.
postmaster_address = [email protected].
但仍然发件人:邮政局长 只需注意:dovecot,postfix 已重新启动。
您能告诉我该怎么做才能将它改成别的东西或者完全摆脱它吗?
这是我的脚本
require ["enotify", "mailbox", "reject", "variables"];
if header :matches "to" ["*", "*", "*"] {
set "r1" "${1}";
set "r2" "${2}";
set "r3" "${3}";
}
if header :matches "from" "*" {
set "sender" "${1}";
}
#sets variables for position in the address and it works for CC and BC aswell.
#This is the way sieve works by setting position in the line for TO or FROM.
if header :matches "Subject" "SEC=SECRET" {
notify :importance "1"
:message "SEC=SECRET Email Received"
"mailto:${r1}${r2}${r3}";
}
if header :matches "Subject" "SEC=TOP SECRET" {
notify :importance "1"
:message "You have received an email with a SECRET or TOP SECRET classification from ${sender}. The message exceeds the classification of company's email system and has been discarded. The sender of the message has also been informed"
"mailto:${r1}${r2}${r3}";
}
if header :matches "Subject" "SEC=TOP-SECRET" {
notify :importance "1"
:message "You have received an email with a SECRET or TOP SECRET classification from ${sender}. The message exceeds the classification of company's email system and has been discarded. The sender of the message has also been informed"
"mailto:${r1}${r2}${r3}";
}
#matches the Subject and if it containes SECRET or TOP SECRET
#sends notification to receivers specified in mailto:
#doesn't include the body of email
if anyof (header :contains "Subject" "SEC=SECRET",
header :contains "Subject" "SEC=TOP SECRET",
header :contains "Subject" "SEC=TOP-SECRET")
{
reject "Our systems have not been certified to accept emails classified as SECRET or TOP-SECRET. Your message has been deleted and the recipients have been informed.";
}
#matches the Subject, drops the body and sends notification to the sender with the message specified.
答案1
感谢您的回复。
我不确定您是否明白我在这里想要做什么。
这是实际任务:“电子邮件服务器配置为阻止、记录和报告带有不适当保护标记的电子邮件。”“任何被阻止的入站电子邮件的预期收件人以及任何被阻止的出站电子邮件的发件人都会收到通知。”使用 docker-mailserver 容器构建测试邮件服务器,并开发内容过滤器插件,用于阻止、记录和报告主题行中带有 SEC=SECRET 或 SEC=TOP SECRET 的消息。通知发件人和收件人,但不泄露邮件内容。
如果我错了,请纠正我。在您的评论中,您谈到了“enotify”操作,但它与我的问题无关,因为我使用它向原始收件人发送通知电子邮件。为了通知原始发件人,我使用“拒绝”操作。这意味着当收到的电子邮件被丢弃并回复后,原始发件人会收到来自邮政局长的电子邮件。那么问题是如何摆脱它?
谢谢