我设置postifx作为邮件中继与外部smtp服务器configuration。 总体来说这工作正常。 但我的目标是,所有的邮件将转发到外部smtp服务器 – 除了根。
/etc/postfix/main.cf文件:
#myorigin = /etc/mailname smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU) 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_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. smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination myhostname = example.com alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases myorigin = /etc/mailname mydestination = localhost relayhost = [smtp.relay.com]:587 mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 mailbox_size_limit = 0 recipient_delimiter = + inet_interfaces = 127.0.0.1 smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_sasl_security_options = smtpd_use_tls=yes smtp_tls_security_level = encrypt
通过这个configuration,postfix试图通过SMTP服务器发送root邮件到[email protected]。 本地交付根是我的首选解决scheme。
谁能帮忙?
谢谢!
由于后缀设置提供了各种各样的设置以下是一些注意事项, 可能会有所帮助,因为它们启用了在安装了Postfix的Ubuntu 16系统上的本地邮件传递(path可能在不同的系统上有所不同):
Postfix不会传送到根目录,但是你可以把所有的邮件redirect到另一个本地主机用户acount,例如后缀用户(如果存在的话),但任何其他用户都可以。 为了编辑
/ etc / aliases中
到,例如:
postmaster: <USER1> root: <USER1> <USER2>: <USER1> ...
然后发出命令
sudo newaliases
Procmail必须安装,这可以通过命令完成
sudo apt安装procmail
(可以放弃procmail已经安装。)
在一些设置
/etc/postfix/main.cf中
也许
myhostname = <HOSTNAME>@<LOCALNET> mydestination = <ALL HOSTNAMES ASSIGNED TO 127.0.0.1, MAYBE ::1, IN /etc/hosts, DELIMITED BY SPACE> local_transport = local mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 # following all possible arguments, strip as you like notify_classes = bounce, 2bounce, delay, policy, protocol, resource, software
发出命令后,修改将生效
sudo服务postfix重启
它有助于阅读日志文件
/var/log/mail.log,/var/log/mail.err
更有帮助的阅读:
http://www.postfix.org/BASIC_CONFIGURATION_README.html
http://www.postfix.org/LOCAL_RECIPIENT_README.html