How can I set Postfix outgoing port to 465, but keep incoming port to default?

My ISP blocks port 25. So, I cannot connect to my server and send emails. I've tried changing it to 465. And it works! However, after this change, I cannot receive emails anymore.

#
# 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

The above is my master file after the 465 change. (notice the first line).

I cannot receive emails anymore after this change. Please help! Thanks!


Solution 1:

You won't receive any mails, because the SMTP servers send mails between each other on port 25. ISP's block the outgoing port 25 to stop spam and this is now almost "an industry standard". Port 465 and 587 should be used for client - server connections only, so 99% of SMTP servers which will send mails to your server will do it on port 25. As you have changed the port from 25 to 465, they won't be able to connect to your server.

Most probably you would need some kind of relay host which will forward mails to your server on different port.

Solution 2:

Don't remove the SMTP default configuration, just add the port you want Postfix to listen to perform the appropriate SMTPd action:

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

This way, you'll be able to send mails through port 465, and receive mails from the SMTP port (25).