我在 Linux 上配置了带有 dovecot 的 postfix 邮件服务器。现在的问题是,当我配置自动回复时,它会向发件人回复两封邮件。我使用 vacation.pl(postfix 管理员的 Perl 脚本)自动向发件人回复邮件。我之前已经配置过它,当时测试过没有问题。但在更改数据库结构后,我更改了 postfix 配置、dovecot 配置和 vacation.pl 脚本。我认为数据库查询没有问题。
当我向某个用户发送密件抄送时,我也遇到了同样的问题。该用户将收到两封邮件。我没有在 dovecot、autoreply 中找到问题出在哪里。
我的master.cf
文件如下所示。
# ==========================================================================
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (yes) (never) (100)
# ==========================================================================
smtp inet n - - - - smtpd
# -o content_filter=spamfilter:dummy
-o content_filter=vacation:dummy
-o content_filter=dfilt:dummy
vacation unix - n n - - pipe
flags=Rq user=vacation argv=/var/spool/vacation/vacation3.pl -f ${sender} -- ${recipient}
# flags=Rq user=vacation argv=/usr/bin/perl argv=/var/spool/vacation/vacation.pl -f ${sender} -- ${recipient}
pickup fifo n - n 60 1 pickup
cleanup unix n - n - 0 cleanup
qmgr fifo n - n 300 1 qmgr
#qmgr fifo n - n 300 1 oqmgr
tlsmgr unix - - n 1000? 1 tlsmgr
rewrite unix - - n - - trivial-rewrite
bounce unix - - n - 0 bounce
defer unix - - n - 0 bounce
trace unix - - n - 0 bounce
verify unix - - n - 1 verify
flush unix n - n 1000? 0 flush
proxymap unix - - n - - proxymap
proxywrite unix - - n - 1 proxymap
smtp unix - - n - - smtp
# When relaying mail as backup MX, disable fallback_relay to avoid MX loops
relay unix - - n - - smtp
-o smtp_fallback_relay=
# -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq unix n - n - - showq
error unix - - n - - error
retry unix - - n - - error
discard unix - - n - - discard
local unix - n n - - local
virtual unix - n n - - virtual
lmtp unix - - n - - lmtp
anvil unix - - n - 1 anvil
scache unix - - n - 1 scache
#
#spamassassin unix - n n - - pipe
# flags=Rq user=spamd argv=/usr/bin/spamc -u ${user} -e /usr/sbin/sendmail -oi -f ${sender} ${recipient}
dovecot unix - n n - - pipe
flags=DRhu user=vmail:vmail argv=/usr/libexec/dovecot/deliver -d ${recipient}
#spamfilter unix - n n - - pipe
# flags=Rq user=spamfilter argv=/usr/local/bin/spamfilter.sh -f ${sender} -- ${recipient}
#spamfilter unix - n n - - pipe
# flags=Rq user=vmail argv=/usr/bin/spamc -u ${user}@${domain} -e /usr/sbin/sendmail.postfix -oi -f ${sender} ${recipient}
dfilt unix - n n - - pipe
flags=Rq user=filterAlt argv=/etc/postfix/disclaimer -f ${sender} -- ${recipient}
#vacation unix - n n - - pipe
# flags=Rq user=vacation argv=/var/spool/vacation/vacation3.pl -f ${sender} -- ${recipient}
答案1
您可以通过筛选插件进行休假回复。它们还将添加强大的服务器端邮件过滤功能。
休假响应者的筛选文件示例:
require ["fileinto", "vacation"];
vacation
# Reply at most once a day to a same sender
:days 1
:subject "Out of office reply"
# List of additional recipient addresses which are included in the auto replying.
# If a mail's recipient is not the envelope recipient and it's not on this list,
# no vacation reply is sent for it.
:addresses ["[email protected]", "[email protected]"]
"I'm out of office, please contact Joan Doe instead.
Best regards
John Doe";
看Dovecot 筛分页了解更多信息。
答案2
我也遇到过内容过滤器的问题。在内容过滤器后添加此行可修复多条消息被发送的问题。
-o receive_override_options=no_address_mappings
在您的 smtp 声明中的所有过滤器之后添加该行,使其看起来像这样..
smtp inet n - - - - smtpd
# -o content_filter=spamfilter:dummy
-o content_filter=vacation:dummy
-o content_filter=dfilt:dummy
-o receive_override_options=no_address_mappings
但不可否认的是,我只用 spamassassin 过滤器测试过它。如果它有效,请告诉我。