Postfix:发送邮件或解析别名都可以

Postfix:发送邮件或解析别名都可以

我想在 Ubuntu Server 14.04 LTS(仅限)上使用 Postfix 2.11 将发送到本地用户帐户的邮件转发到使用另一个 SMTP 服务器的相应邮箱。

配置:

$ postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
inet_interfaces = loopback-only
inet_protocols = all
mailbox_size_limit = 0
mydestination = localhost mydomain.tld, myhostname, localhost.localdomain, localhost
myhostname = myhostname
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
readme_directory = no
recipient_delimiter = +
relayhost = my-target-smtp-server
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes

$ cat /etc/aliases
root: [email protected]

如果我向 root 用户发送一封邮件

$ echo "body"| mail -s "test" root

我看到以下日志条目/var/log/mail.log

Nov  6 12:40:19 myhostname postfix/pickup[1854]: BD20144EC2: uid=0 from=<root>
Nov  6 12:40:19 myhostname postfix/cleanup[1898]: BD20144EC2: message-id=<20151106114019.BD20144EC2@myhostname>
Nov  6 12:40:19 myhostname postfix/qmgr[1855]: BD20144EC2: from=<[email protected]>, size=414, nrcpt=1 (queue active)
Nov  6 12:40:19 myhostname postfix/local[1901]: BD20144EC2: to=<[email protected]>, orig_to=<root>, relay=local, delay=0.15, delays=0.11/0/0/0.03, dsn=5.1.1, status=bounced (unknown user: "some-account")
Nov  6 12:40:19 myhostname postfix/cleanup[1898]: D21A344EC4: message-id=<20151106114019.D21A344EC4@myhostname>
Nov  6 12:40:19 myhostname postfix/bounce[1902]: BD20144EC2: sender non-delivery notification: D21A344EC4
Nov  6 12:40:19 myhostname postfix/qmgr[1855]: D21A344EC4: from=<>, size=2165, nrcpt=1 (queue active)
Nov  6 12:40:19 myhostname postfix/qmgr[1855]: BD20144EC2: removed
Nov  6 12:40:19 myhostname postfix/local[1901]: D21A344EC4: to=<[email protected]>, orig_to=<[email protected]>, relay=local, delay=0.07, delays=0.03/0/0/0.03, dsn=5.1.1, status=bounced (unknown user: "some-account")
Nov  6 12:40:19 myhostname postfix/qmgr[1855]: D21A344EC4: removed

那么,出于什么原因,postfix 不会使用中继服务器转发邮件。如果我从中删除“mydomain.tld”我的目的地,邮件通过提供的 SMTP 服务器正确发送中继主机,但所有信息/etc/别名被默默忽略:邮件被发送至[电子邮件保护]代替[电子邮件保护]

您知道可能存在什么问题吗?

答案1

我非常确定您应该从 mydestination 中删除“mydomain.tld”。mydestination 中的条目之间也必须有一个逗号(您已写入 localhost mydomain.tld)。

修改 /etc/aliases 后,您是否运行过“newaliases”命令?

相关内容