我希望使用后缀将所有传入的邮件发送到任何地址(包括未映射到本地用户的地址),以管道方式发送到脚本。我已经尝试mailbox_command
在中进行配置/etc/postfix/main.cf
:
mailbox_command = /path/to/myscript.py
如果用户是本地用户,则此方法效果很好,但对于没有别名的“未知”用户,此方法将失败。我尝试设置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.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
readme_directory = no
# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
myhostname = ... snip ...
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = sassafras, ... snip ...,localhost.localdomain, localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
mailbox_command = /path/to/my/script.py