无法通过 Mac Mail 应用程序通过 Postfix SMTP 发送电子邮件

无法通过 Mac Mail 应用程序通过 Postfix SMTP 发送电子邮件

我安装了一个 SMTP 服务器,使用 Postfix 作为邮件代理(在 Ubuntu 12.04 上)。配置如下:

$ postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
inet_interfaces = all
inet_protocols = all
mailbox_size_limit = 0
milter_default_action = accept
milter_protocol = 2
mydestination = mail.example.com, example.com, example, localhost.localdomain, localhost
myhostname = mail.example.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 203.80.250.0/26 192.168.200.0/24 218.213.78.192/26 59.148.211.162/32 10.0.0.0/8
myorigin = /etc/mailname
non_smtpd_milters = inet:localhost:12301
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_milters = inet:localhost:12301
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

然而,当我尝试在与我的服务器位于不同网络的 Mac 上使用此 SMTP 时,发生了奇怪的事情。

当我使用 Mac OS X (10.10.3) 的 Mail App 时,提示无法连接 SMTP。设置如下:

  • 邮件服务器:mail.example.com
  • 端口:25
  • 身份验证:否
  • 用户名和密码:空
  • 使用 SSL:否

但是,我telnet在终端中使用,它有效:

$telnet mail.example.com 25
Trying 123.123.123.123...
Connected to mail.example.com.
Escape character is '^]'.
220 mail.example.com ESMTP Postfix (Ubuntu)
HELO example.com
250 mail.example.com
MAIL FROM: [email protected]
250 2.1.0 Ok
RCPT TO: [email protected]
250 2.1.5 Ok
DATA
Testing
.
250 2.0.0 Ok: queued as E44CC240959
QUIT
221 2.0.0 Bye

我觉得响应很好。我错过了哪些 Postfix 设置?

附言

  1. 所有域名均替换为 example.com
  2. [电子邮件保护]是在服务器上创建的电子邮件帐户
  3. 还安装了 Dovecot
  4. SMTP 服务器正在监听 0.0.0.0:25

更新Mail App 的 Mail Connection Doctor 中的确切错误消息是:

无法连接到此 SMTP 服务器。请检查您的网络连接以及您在帐户偏好设置中输入的信息是否正确。

--

更新我启用了邮件应用程序的日志记录,它给我带来了这个有用的日志(包含错误消息):

Jun 10 20:23:54 RaptoriMac.local Mail[413] <Debug>: [0x7fc3dc4edae0] << 220  (41 additional bytes)
Jun 10 20:23:54 RaptoriMac.local Mail[413] <Debug>: Connected: <MFSMTPConnection: 0x7fc3dc4edae0> (Connected) account: A{SMTP - 89AD1B73-5242-45DF-99C3-10B294A5D489}
    hostname: mail.example.com, port: 25, security layer: kCFStreamSocketSecurityLevelNone
Jun 10 20:23:54 RaptoriMac.local Mail[413] <Debug>: [0x7fc3dc4edae0] >> EHLO  (16 additional bytes) 
Jun 10 20:23:54 RaptoriMac.local Mail[413] <Debug>: [0x7fc3dc4edae0] << 250-mail.example.com

Jun 10 20:23:54 RaptoriMac.local Mail[413] <Debug>: [0x7fc3dc4edae0] << 250-PIPELINING

Jun 10 20:23:54 RaptoriMac.local Mail[413] <Debug>: [0x7fc3dc4edae0] << 250-SIZE 10240000

Jun 10 20:23:54 RaptoriMac.local Mail[413] <Debug>: [0x7fc3dc4edae0] << 250-VRFY

Jun 10 20:23:54 RaptoriMac.local Mail[413] <Debug>: [0x7fc3dc4edae0] << 250-ETRN

Jun 10 20:23:54 RaptoriMac.local Mail[413] <Debug>: [0x7fc3dc4edae0] << 250-STARTTLS

Jun 10 20:23:54 RaptoriMac.local Mail[413] <Debug>: [0x7fc3dc4edae0] << 250-ENHANCEDSTATUSCODES

Jun 10 20:23:54 RaptoriMac.local Mail[413] <Debug>: [0x7fc3dc4edae0] << 250-8BITMIME

Jun 10 20:23:54 RaptoriMac.local Mail[413] <Debug>: [0x7fc3dc4edae0] << 250 DSN

Jun 10 20:23:54 RaptoriMac.local Mail[413] <Debug>: [0x7fc3dc4edae0] >> STARTTLS (0 additional bytes) 
Jun 10 20:23:54 RaptoriMac.local Mail[413] <Debug>: [0x7fc3dc4edae0] << 220 2.0.0  (18 additional bytes)
Jun 10 20:23:54 RaptoriMac.local Mail[413] <Debug>: Could not connect: <MFSMTPConnection: 0x7fc3dc4edae0> (Disconnected) account: A{SMTP - 89AD1B73-5242-45DF-99C3-10B294A5D489} (Error Domain=NSPOSIXErrorDomain Code=61 "The operation couldn’t be completed. Connection refused")
Jun 10 20:23:54 RaptoriMac.local Mail[413] <Debug>: Could not connect: <MFSMTPConnection: 0x7fc3dc4edae0> (Disconnected) account: A{SMTP - 89AD1B73-5242-45DF-99C3-10B294A5D489} (Error Domain=NSPOSIXErrorDomain Code=61 "The operation couldn’t be completed. Connection refused")

错误消息位于命令后的最后一行STARTTLS

无法连接:(已断开连接)帐户:A{SMTP - 89AD1B73-5242-45DF-99C3-10B294A5D489}(错误域 = NSPOSIXErrorDomain 代码 = 61“操作无法完成。连接被拒绝”)

我该如何解决?我已经标记了allow using insecure connection,但它仍然尝试启动 TLS 连接。我认为它尝试连接被防火墙阻止的端口 465。我说得对吗?

相关内容