dee4 wrote:
- Uncommenting "submission" as shown in the guide turns on Postfix listening on port 587.
- Uncommenting "smtps" as shown in the guide turns on Postfix listening on port 465.
This is correct. The "submission" and "smtps" are names that can be used in place of port numbers. If you look at /etc/services, you will see a whole long list of these names and the ports to which they correspond. Postfix, and many other programs (but not all) recognize the names in /etc/services. For example,
telnet bar.example.net smtp would attempt to connect to port 25 on bar.example.net.
dee4 wrote:
Are you able to explain, the way you see it, the differences between ports 25, 587, and 465?
Port 25 has been used for many, many years for exchanging mail. All connections are initially plaintext, but can be upgraded to an encrypted connection if both sides support STARTTLS. You can test this as follows, assuming your Internet provider does not block connections to port 25 (very many do):
Code:
$ telnet bar.example.net 25
Trying 4.3.2.1...
Connected to bar.example.net.
Escape character is '^]'.
220-bar.example.net ESMTP Sendmail 8.14.4/8.14.4
220 Keep your spam, please. We don't want it.
EHLO foo.example.org
250-bar.example.net Hello foo.example.org [5.6.7.8], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-EXPN
250-VERB
250-8BITMIME
250-SIZE 5242880
250-DSN
250-ETRN
250-AUTH DIGEST-MD5 CRAM-MD5 LOGIN PLAIN
250-STARTTLS
250-DELIVERBY
250 HELP
QUIT
221 2.0.0 bar.example.net closing connection
Connection closed by foreign host.
In this test, the EHLO and QUIT lines are commands I typed. In response to the EHLO, the server responded that it supports STARTTLS. You'll also note that it supports AUTH, which means that one could authenticate with a username and password when sending a message.
According to the
Wikipedia entry, port 465 was at one time intended to be used for TLS-encrypted (only) connections to mail servers. Think of the relationship between 25 and 465 the same as ports 80 (used for plain http) and 443 (used for https). Apparently the need to dedicate a separate port to smtps was obsoleted by the development of STARTTLS, but some clients and servers still support using it.
Port 587 is intended for mail
submission. Distinct from
relaying, where a mail server simply hands a message off to another that it thinks is an appropriate destination, some additional assumptions (delineated in
RFC 6409) apply to submission. First, the server needs to authenticate the submitter by some method - this could be AUTH (mentioned above), by recognizing the IP address of the submitter, or something else entirely. The server also needs to verify that the message is well-formed and do some clean-ups if it isn't. While in theory port 25 can also be used for this, using a different port cleanly separates submission from relaying and avoids the problem of ISPs blocking access to port 25.