我已经在 Ubuntu LTS 安装上安装并成功配置了 exim4 和 sa-exim。垃圾邮件已成功标记:
X-SA-Exim-Connect-IP: 89.238.139.198
X-SA-Exim-Mail-From: hertaqcrqsaa@xxx
Subject: =?UTF-8?Q?F=C3=BCr_den_privaten_und_gesch=C3=A4ftlichen_Gebrauch:_=C3=B6konomische_LED-Lampen,_verbilligt?=
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.root42.de
X-Spam-Flag: YES
X-Spam-Level: **********
X-Spam-Status: Yes, score=10.3 required=5.0 tests=BAYES_60,HTML_IMAGE_ONLY_20,
HTML_MESSAGE,HTML_SHORT_LINK_IMG_3,RCVD_IN_SBL_CSS,SPF_PASS,
T_DKIM_INVALID,URIBL_ABUSE_SURBL,URIBL_BLOCKED,URIBL_DBL_SPAM
autolearn=no autolearn_force=no version=3.4.2
X-SA-Exim-Version: 4.2.1 (built Sun, 16 Aug 2015 09:47:16 +0000)
X-SA-Exim-Scanned: Yes (on xxx.xxxxxx.de)
但电子邮件仍会发送到用户的收件箱 Maildir。我该如何将其更改为发送到用户的 .Spam Maildir?
答案1
答案2
我自己通过优秀的进出口维基:
首先,您必须创建一个/etc/exim4/conf.d/router/899_exim4-config_local_user_spam
包含以下内容的文件:
### router/900_exim4-config_local_user_spam
#################################
# This router matches local user mailboxes. If the router fails, the error
# message is "Unknown user".
local_user_spam:
debug_print = "R: local_user_spam for $local_part@$domain"
driver = accept
domains = +local_domains
check_local_user
local_parts = !www:!root:!nobody:!postmaster:!abuse:!admin
transport = maildir_spam_delivery
condition = ${if def:h_X-Spam-Flag: {true}}
cannot_route_message = Unknown user
这将在编号为 900 的本地用户路由器之前进行匹配。这确保垃圾邮件将使用以下传输方式传递。
/etc/exim4/conf.d/transport/30_exim4-config_maildir_spam_delivery
使用以下内容创建传输:
### transport/30_exim4-config_maildir_spam_delivery
#################################
# Use this instead of mail_spool if you want to to deliver to Maildir in
# home-directory - change the definition of LOCAL_DELIVERY
#
maildir_spam_delivery:
debug_print = "T: maildir_spam_delivery for $local_part@$domain"
driver = appendfile
.ifdef MAILDIR_HOME_MAILDIR_LOCATION
directory = MAILDIR_HOME_MAILDIR_LOCATION/.Junk
.else
directory = $home/Maildir/.Junk
.endif
.ifdef MAILDIR_HOME_CREATE_DIRECTORY
create_directory
.endif
.ifdef MAILDIR_HOME_CREATE_FILE
create_file = MAILDIR_HOME_CREATE_FILE
.endif
delivery_date_add
envelope_to_add
return_path_add
maildir_format
.ifdef MAILDIR_HOME_DIRECTORY_MODE
directory_mode = MAILDIR_HOME_DIRECTORY_MODE
.else
directory_mode = 0700
.endif
.ifdef MAILDIR_HOME_MODE
mode = MAILDIR_HOME_MODE
.else
mode = 0600
.endif
mode_fail_narrower = false
# This transport always chdirs to $home before trying to deliver. If
# $home is not accessible, this chdir fails and prevents delivery.
# If you are in a setup where home directories might not be
# accessible, uncomment the current_directory line below.
# current_directory = /
这基本上是默认传输的副本maildir_home
,仅附加/.Junk
到 maildir 名称。
我确信 exim4 可以通过一些 if 和 else 更优雅地完成此操作,但我的 exim foo 还不够好。欢迎任何 exim 专业人士为该解决方案做出贡献。