我想在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不会使用中继服务器来转发邮件。 如果我从mydestination中删除了“mydomain.tld”,则邮件通过作为中继主机提供的SMTP服务器正确发送,但是/ etc / aliases中的所有信息都将被忽略:邮件发送到[email protected]而不是某个帐户@ mydomain.tld 。
你有什么想法可能是什么问题?
我很确定你应该从mydestination中删除“mydomain.tld”。 在mydestination中的条目之间也必须有一个逗号(你写了localhost mydomain.tld)。
你在修改/ etc / aliases之后运行了“newaliases”命令吗?