知乎专栏 |
背景,网站通常需要一个电子邮件服务器,用于认证邮件真实性,给用户发送通知,订阅邮件等等。
这个邮件系统只需要外发邮件,并不需要接收邮件,配置如下。
[root@netkiller postfix]# postconf -n alias_database = hash:/etc/aliases alias_maps = hash:/etc/aliases command_directory = /usr/sbin config_directory = /etc/postfix daemon_directory = /usr/libexec/postfix data_directory = /var/lib/postfix debug_peer_level = 2 debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5 home_mailbox = Maildir/ html_directory = no inet_interfaces = all inet_protocols = ipv4 mail_owner = postfix mailq_path = /usr/bin/mailq.postfix manpage_directory = /usr/share/man milter_default_action = accept milter_protocol = 2 mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain mydomain = netkiller.cn myhostname = mail.netkiller.cn mynetworks = 203.88.18.17, 202.130.11.34, 147.89.27.78, 219.90.13.18 myorigin = $mydomain newaliases_path = /usr/bin/newaliases.postfix non_smtpd_milters = $smtpd_milters queue_directory = /var/spool/postfix readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES sample_directory = /usr/share/doc/postfix-2.10.1/samples sendmail_path = /usr/sbin/sendmail.postfix setgid_group = postdrop smtpd_milters = inet:127.0.0.1:8891 unknown_local_recipient_reject_code = 550
EDM服务器建议配置
postconf -e "default_destination_concurrency_limit=5" postconf -e "queue_run_delay = 12h" postconf -e "maximal_queue_lifetime = 1d"
首先投递目的主机不能并发太多,发送失败的邮件一天只需要重发一次就可以,隔天是吧队列直接抛弃无需保留。
neo@netkiller ~ % postconf -n alias_database = hash:/etc/aliases alias_maps = hash:/etc/aliases append_dot_mydomain = no biff = no compatibility_level = 2 inet_interfaces = all inet_protocols = all mailbox_size_limit = 0 message_size_limit = 1024000000 mydestination = $myhostname, netkiller.cn, netkiller.netkiller.com, localhost.netkiller.com, localhost myhostname = netkiller.netkiller.com mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 myorigin = /etc/mailname readme_directory = no recipient_delimiter = + relayhost = 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