无法连接到 587 上的 Postfix

无法连接到 587 上的 Postfix

我花了很多时间在这里的相关帖子上寻找答案,但无济于事。所以我在这里问这个问题。

  • 我有:Debian 8、Postfix、Dovecot
  • 我可以使用 roundcube 发送和接收电子邮件。
  • 我可以用雷鸟接收电子邮件。
  • 我无法使用雷鸟发送电子邮件。
  • Thunderbird 表示它已连接到服务器,但由于服务器没有响应而超时。
  • 我禁用了防火墙。
  • 我不确定在服务器名称字段中应该填写什么。
  • 我尝试发送的电子邮件最终出现在服务器上的概念框中

我跟着https://workaround.org/ispmail/jessie

这是我当前的配置。

config_directory = /etc/postfix
inet_interfaces = all
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
milter_default_action = accept
milter_protocol = 2
mydestination = server.example.com, localhost.example.com, localhost
myhostname = server.example.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
non_smtpd_milters = local:/opendkim/opendkim.sock
policyd-spf_time_limit = 3600
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_sasl_auth_enable = yes
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
smtpd_milters = local:/opendkim/opendkim.sock
smtpd_recipient_restrictions = reject_unauth_destination, check_policy_service unix:private/policyd-spf, permit_sasl_authenticated, permit_mynetworks
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_path = private/auth
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/.ssl/mail_example_com_bundle.crt
smtpd_tls_key_file = /etc/.ssl/mail_example_com.key
smtpd_tls_mandatory_protocols = !SSLv2,!SSLv3
smtpd_tls_security_level = may
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
virtual_transport = lmtp:unix:private/dovecot-lmtp
root@server:/etc/dovecot/conf.d# clear
root@server:/etc/dovecot/conf.d# 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
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
milter_default_action = accept
milter_protocol = 2
mydestination = server.example.com, localhost.example.com, localhost
myhostname = server.example.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
non_smtpd_milters = local:/opendkim/opendkim.sock
policyd-spf_time_limit = 3600
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_sasl_auth_enable = yes
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
smtpd_milters = local:/opendkim/opendkim.sock
smtpd_recipient_restrictions = reject_unauth_destination, check_policy_service unix:private/policyd-spf, permit_sasl_authenticated, permit_mynetworks
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_path = private/auth
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/.ssl/mail_example_com_bundle.crt
smtpd_tls_key_file = /etc/.ssl/mail_example_com.key
smtpd_tls_mandatory_protocols = !SSLv2,!SSLv3
smtpd_tls_security_level = may
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
virtual_transport = lmtp:unix:private/dovecot-lmtp

postconf | grep smtpd_sasl_auth_enable:

smtpd_sasl_auth_enable = yes

postconf | grep smtp_sasl_auth_enable:

smtp_sasl_auth_enable = yes

当我使用 telnet 连接到端口 25 时,我从 ehlo 收到以下响应

250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN

AUTH 未启用。为什么?

当我尝试使用 587 上的 telnet 连接时,我看到一个空白屏幕。

我不知道。希望这里有人知道。

多谢。

答案1

您需要告诉 postfix 监听提交端口。查看 master.cf(通常在 /etc/postfix 下),然后取消注释以下行:

submission inet n       -       -       -       -       smtpd

另外,请检查防火墙设置,以确保您的客户端可以访问端口 587。

答案2

对于提交来说这是你应该做的master.cf

submission inet n       -       -       -       -       smtpd
 -o syslog_name=postfix/submission
 -o smtpd_tls_security_level=encrypt
 -o smtpd_sasl_auth_enable=yes
 -o smtpd_client_restrictions=permit_sasl_authenticated,reject
 -o milter_macro_daemon_name=ORIGINATING

答案3

@cstamas 的建议很好。我注意到 = 周围有空格,smtp_sasl_auth_enable = yes这样 smtp_sasl_auth_enable=yes第一个问题就解决了。

之后我收到错误“中继访问被拒绝”,通过添加以下内容解决了该问题:

  -o smtpd_recipient_restrictions=permit_sasl_authenticated

在 /etc/postfix/master.cf 中

然后我在客户端配置中也遇到了错误。我应该使用安装了有效证书的服务器名称,以便客户端可以验证服务器身份。

相关内容