Postfix 坚持使用端口 25

Postfix 坚持使用端口 25

我有一个 VPS 服务器 LAMP,一切运行正常。但是当我尝试向外部服务器 (outlook.com) 发送电子邮件时,出现此错误(在 postfix 日志中可见):

Jul 23 18:15:00 serv postfix/smtp[1792]: connect to mx3.hotmail.com[65.55.37.104]:25: Connection timed out
Jul 23 18:15:00 serv postfix/smtp[1793]: connect to mx2.hotmail.com[207.46.8.167]:25: Connection timed out

我尝试更改 postfix main.cf 文件中的 smtp 端口,尝试使用文件传输创建路由,但同样没有成功。根据我的 VPS 提供商的说法,端口 25 已被阻止并引导我进行更改。我在几个地方读到过关于它的内容,我知道这实际上是 SMTP 服务器之间通信的门户,但我仍然无法更改它。下面是 main.cf

# postfix config file
# uncomment for debugging if needed
soft_bounce=yes

# postfix main
mail_owner = postfix
setgid_group = postdrop
delay_warning_time = 4

# postfix paths
html_directory = no
command_directory = /usr/sbin
daemon_directory = /usr/lib/postfix
queue_directory = /var/spool/postfix
sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.2.2/samples
readme_directory = /usr/share/doc/postfix-2.2.2/README_FILES

# network settings
inet_interfaces = all
mydomain   = zpanel
myhostname = zpanel
mynetworks = all
mydestination = localhost.$mydomain, localhost
relay_domains = proxy:mysql:/etc/zpanel/configs/postfix/mysql-relay_domains_maps.cf

# mail delivery
recipient_delimiter = +
# mappings
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
transport_maps = hash:/etc/zpanel/configs/postfix/transport
#local_recipient_maps =

# virtual setup
virtual_alias_maps = proxy:mysql:/etc/zpanel/configs/postfix/mysql-virtual_alias_maps.cf,
                 regexp:/etc/zpanel/configs/postfix/virtual_regexp
virtual_mailbox_base = /var/zpanel/vmail
virtual_mailbox_domains = proxy:mysql:/etc/zpanel/configs/postfix/mysql-           virtual_domains_maps.cf
virtual_mailbox_maps = proxy:mysql:/etc/zpanel/configs/postfix/mysql-virtual_mailbox_maps.cf
virtual_mailbox_limit_maps = proxy:mysql:/etc/zpanel/configs/postfix/mysql- virtual_mailbox_limit_maps.cf
virtual_minimum_uid = 150
virtual_uid_maps = static:150
virtual_gid_maps = static:8
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1

# debugging
debug_peer_level = 2
debugger_command =
     PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
     xxgdb $daemon_directory/$process_name $process_id & sleep 5

# authentication
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
broken_sasl_auth_clients = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth

# tls config
smtp_use_tls = no
smtpd_use_tls = no
#smtp_tls_note_starttls_offer = yes
#smtpd_tls_loglevel = 1
#smtpd_tls_received_header = yes
#smtpd_tls_session_cache_timeout = 3600s
#tls_random_source = dev:/dev/urandom
#smtp_tls_session_cache_database = btree:$data_directory/smtp_tls_session_cache
# Change mail.example.com.* to your host name
#smtpd_tls_key_file = /etc/pki/tls/private/mail.example.com.key
#smtpd_tls_cert_file = /etc/pki/tls/certs/mail.example.com.crt
# smtpd_tls_CAfile = /etc/pki/tls/root.crt

# rules restrictions
smtpd_client_restrictions =
smtpd_helo_restrictions =
smtpd_sender_restrictions =
smtpd_recipient_restrictions = permit_sasl_authenticated,
    permit_mynetworks,
    reject_unauth_destination,
    reject_non_fqdn_sender,
    reject_non_fqdn_recipient,
    reject_unknown_recipient_domain
# uncomment for realtime black list checks
#       ,reject_rbl_client zen.spamhaus.org
#       ,reject_rbl_client bl.spamcop.net
#       ,reject_rbl_client dnsbl.sorbs.net

smtpd_helo_required = yes
unknown_local_recipient_reject_code = 550
disable_vrfy_command = yes
smtpd_data_restrictions = reject_unauth_pipelining

答案1

TCP 端口 25 是 SMTP 通信的默认端口,也是通过互联网传输电子邮件的唯一可接受方式。Postfix 坚持使用该端口是正确的。

端口 25 上的传出流量通常被阻止消费者ISP、企业、政府和大学网络等,以防止其用户传输未经授权的电子邮件和垃圾邮件。

通常,这些 ISP 和网络运营商会为其用户提供一个外发 SMTP 服务器,以强制网络中的用户遵守本地策略。在 sendmail 术语中,该外发邮件服务器称为智能主机,在 Postfix 中,它通常称为中继主机

向您的 ISP 询问正确的服务器名称并配置类似/etc/postfix/main.cf以下内容的内容:

relayhost = smtp.example.com

如果您需要提供用户名和密码才能使用,smtp.example.com请查看http://postfix.state-of-mind.de/patrick.koetter/smtpauth/smtp_auth_mailservers.html

相关内容