我正在尝试在 ubuntu 12.04 中使用 postfix 和 dovecot 设置邮件服务器,如下所示本指南。一切似乎都正确无误,当我尝试这样做时,一切都按预期进行。但是当我尝试从我的 gmail 帐户向服务器发送邮件时,我收到此错误echo test | mail [email protected]
Delivery to the following recipient failed permanently:
[email protected]
Technical details of permanent failure:
Google tried to deliver your message, but it was rejected by the server for the recipient domain example.org by aspmx.l.google.com. [2607:f8b0:4001:c05::1a].
The error that the other server returned was:
550-5.1.1 The email account that you tried to reach does not exist. Please try
550-5.1.1 double-checking the recipient's email address for typos or
550-5.1.1 unnecessary spaces. Learn more at
550 5.1.1 http://support.google.com/mail/bin/answer.py?answer=6596 m1si13660174ige.61 - gsmtp
发送邮件失败后,我尝试使用以下方式测试邮件服务器这由于我的 HTTPS 证书无效,我收到 1 个错误,由于我的自定义 SMTP 横幅和缺少 SPF 记录,我收到 7 个警告。关于如何更改我的 HTTPS 证书以及它是否与 Gmail 存在问题,您有什么想法吗?
我也尝试过从这里我得到了这个结果:
Resolving hostname...
Connecting...
SMTP -> FROM SERVER:
220 floatnet.org ESMTP Postfix (Ubuntu)
SMTP -> FROM SERVER:
250-floatnet.org
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
MAIL FROM: [email protected]
SMTP -> FROM SERVER:
530 5.7.0 Must issue a STARTTLS command first
SMTP -> ERROR: MAIL not accepted from server: 530 5.7.0 Must issue a STARTTLS command first
RCPT TO: [email protected]
SMTP -> FROM SERVER:
530 5.7.0 Must issue a STARTTLS command first
SMTP -> ERROR: RCPT not accepted from server: 530 5.7.0 Must issue a STARTTLS command first
Message sending failed.
这是我的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
smtpd_tls_cert_file=/etc/ssl/certs/dovecot.pem
smtpd_tls_key_file=/etc/ssl/private/dovecot.pem
smtpd_use_tls=yes
smtpd_tls_auth_only = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_recipient_restrictions =
permit_sasl_authenticated,
permit_mynetworks,
reject_unauth_destination
#smtpd_reject_unlisted_sender = no
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
myhostname = floatnet.org
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
#mydestination = floatnet.org, vps2473.directvps.nl, localhost.directvps.nl, localhost
mydestination = localhost
virtual_transport = lmtp:unix:private/dovecot-lmtp
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
#smtpd_sasl_type = dovecot
#smtpd_sasl_path = private/auth-client
#smtpd_sasl_auth_enable = yes
#smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination
答案1
实际上,虽然问题相同,但上面有两种不同的错误消息:无法接收电子邮件。
第一个错误发生在您从 GMAIL 发送电子邮件时。它失败并出现错误
Technical details of permanent failure:
Google tried to deliver your message, but it was rejected by the server for the recipient domain domain.org by aspmx.l.google.com. [2607:f8b0:4001:c05::1a].
Google 拒绝您的电子邮件的原因是 floatnet.org 的 MX 记录指向 Gmail 服务器而不是 postfix 服务器。
$ dig floatnet.org MX +short
20 ALT2.ASPMX.L.GOOGLE.COM.
30 ASPMX4.GOOGLEMAIL.COM.
30 ASPMX3.GOOGLEMAIL.COM.
30 ASPMX5.GOOGLEMAIL.COM.
30 ASPMX2.GOOGLEMAIL.COM.
20 ALT1.ASPMX.L.GOOGLE.COM.
10 ASPMX.L.GOOGLE.COM.
解决方案:修复您的 MX 记录。
当您测试 SMTP 服务器时发现了第二个错误。
Must issue a STARTTLS command first
此错误是可能的此问题的重复用于传入 gmx 邮件的 postfix TLS 配置建议的解决方案是将smtpd_tls_security_level
“可能”改为“加密”。
答案2
你的范围 smtpd_tls_auth_only = yes
不允许您跳过 TLS 通信。因此,如果 SMTP 客户端无法(或拒绝)执行 TLS,您的 MTA 将拒绝连接。例如,您的 telnet 会话是明文(无 TLS)。
你可能smtp_use_tls=yes
缺少/etc/posfix/main.cf