我怎样才能将Postfix传出端口设置为465,但保持传入端口默认?

我的ISP阻止端口25.所以,我无法连接到我的服务器,并发送电子邮件。 我试过把它改为465.而且它的工作原理! 但是,在这个变化之后,我再也收不到电子邮件了。

# # Postfix master process configuration file. For details on the format # of the file, see the master(5) manual page (command: "man 5 master"). # # Do not forget to execute "postfix reload" after editing this file. # # ========================================================================== # service type private unpriv chroot wakeup maxproc command + args # (yes) (yes) (yes) (never) (100) # ========================================================================== 465 inet n - - - - smtpd #smtp inet n - - - 1 postscreen #smtpd pass - - - - - smtpd #dnsblog unix - - - - 0 dnsblog #tlsproxy unix - - - - 0 tlsproxy submission inet n - - - - smtpd -o syslog_name=postfix/submission -o smtpd_tls_security_level=encrypt -o smtpd_sasl_auth_enable=yes # -o smtpd_reject_unlisted_recipient=no # -o smtpd_client_restrictions=$mua_client_restrictions # -o smtpd_helo_restrictions=$mua_helo_restrictions # -o smtpd_sender_restrictions=$mua_sender_restrictions -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject -o milter_macro_daemon_name=ORIGINATING -o smtpd_sasl_type=dovecot -o smtpd_sasl_path=private/auth #smtps inet n - - - - smtpd # -o syslog_name=postfix/smtps -o smtpd_tls_wrappermode=no # -o smtpd_sasl_auth_enable=yes # -o smtpd_reject_unlisted_recipient=no # -o smtpd_client_restrictions=$mua_client_restrictions # -o smtpd_helo_restrictions=$mua_helo_restrictions # -o smtpd_sender_restrictions=$mua_sender_restrictions # -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject # -o milter_macro_daemon_name=ORIGINATING 

以上是我465换后的master文件。 (注意第一行)。

这个改变之后,我再也收不到电子邮件了。 请帮忙! 谢谢!

您将不会收到任何邮件,因为SMTP服务器之间在端口25之间发送邮件。ISP的阻止传出端口25,以阻止垃圾邮件,现在这几乎是“行业标准”。 端口465和587应该只用于客户端 – 服务器连接,所以99%的SMTP服务器将发送邮件到您的服务器将在端口25上完成。因为您已经将端口从25更改为465,它们将不会能够连接到您的服务器。

很可能你会需要某种中继主机 ,将邮件转发到不同的端口上的服务器。

不要删除SMTP默认configuration,只需添加您希望Postfix的端口来侦听执行相应的SMTPd操作:

 smtp inet n - - - - smtpd 465 inet n - - - - smtpd #smtp inet n - - - 1 postscreen #smtpd pass - - - - - smtpd #dnsblog unix - - - - 0 dnsblog #tlsproxy unix - - - - 0 tlsproxy submission inet n - - - - smtpd 

这样,您将能够通过端口465发送邮件,并从SMTP端口(25)接收邮件。

其实你已经通过取消注释来启用提交端口它是端口587.你没有启用端口465,因为它不被取消注释(在提交设置下面)465作为服务后缀不知道。 你需要把它改回原来的smtp。 这默认为端口25.像你这样的声音将不会使用它,但港口25用于其他通信。 所以简而言之1)将465改回smtp 2)取消注释smtps上的configuration设置以启用端口465

让Postfix运行在端口25上,并在另一个端口上创build一个端口redirect,比如2525,以便连接到它:

iptables -t nat -I PREROUTING -p tcp --dport 2525 -j REDIRECT --to-port 25

(记得保存规则)