使用 postfix,我希望将所有传入邮件发送到任何地址(包括那些未映射到本地用户的地址)通过管道传输到脚本。我试过配置mailbox_command
中/etc/postfix/main.cf
:
mailbox_command = /path/to/myscript.py
Run Code Online (Sandbox Code Playgroud)
如果用户是本地用户,这很有效,但对于没有别名的“未知”用户则失败。我尝试设置luser_relay
为本地用户,但这会抢占mailbox_command
,因此该命令不会运行。我尝试设置local_recipient_maps=
(空字符串),但消息仍然被退回(未知用户)。
是否有我可以使用的魔术调用来让所有已知和未知用户也转到脚本?
完整/etc/postfix/main.cf
如下——它是默认的 Ubuntu 10.04,除了以下mailbox_command
行:
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
# appending .domain is the MUA's job. …
Run Code Online (Sandbox Code Playgroud)