这是我的main.cf
# 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. smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination myhostname = localhost alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases mydestination = $myhostname, 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 default_transport = smtp relay_transport = smtp inet_protocols = all myorigin = /etc/mailname
它在我的本地机器和我正在使用的一些服务器上是一样的。 另外当应用netstat -nltp |grep master
我在服务器和本地都有相同的输出:
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 29325/master tcp6 0 0 :::25 :::* LISTEN 29325/master
当使用以下方式从本地机器发送电子邮件
echo 'test' | mail -s 'test' [email protected]
其工作100%,我直接收到电子邮件; 但当我尝试在服务器上做同样的事情时,它不工作。
任何帮助将appriciated。 谢谢
更新
#
忘了在/var/log/mail.log中添加错误
connect to gmail-smtp-in.l.google.com[2a00:1450:400c:c06::1a]:25: Network is unreachable
原来,服务器提供商已经阻止了所有的smtp通信。 所以他们提供了解决问题的网关解决scheme。 如果您以相同的情况结束,请联系您的服务器公司。