SMTP is a relatively simple, text-based protocol, where one or more recipients of a message are specified (and in most cases verified to exist) and then the message text is transferred. It is a client-server protocol, where the client transmits an email message to the server. Either an end-user's email client, a.k.a. MUA (Mail User Agent), or a relaying server's MTA (Mail Transfer Agents) can act as an SMTP client.
An email client knows the outgoing mail SMTP server from its configuration. A relaying server typically determines which SMTP server to connect to by looking up the MX (Mail eXchange) DNS record for each recipient's domain name, the part of the email address to the right of the at sign (@). Conformant MTAs (not all) fall back to a simple A record in the case of no MX. Some current mail transfer agents will also use SRV records, a more general form of MX, though these are not widely adopted. (Relaying servers can also be configured to use a smart host.)
The SMTP client initiates a TCP connection to server's port 25 (unless overridden by configuration.) It is quite easy to test an SMTP server using the telnet program (see below).
SMTP is a "push" protocol that does not allow one to "pull" messages from a remote server on demand. To do this a mail client must use POP3 or IMAP. Another SMTP server can trigger a delivery in SMTP using ETRN.
Outgoing mail SMTP server
An email client requires the name or the IP address of an SMTP server as part of its configuration. The server will take care of delivering messages on behalf of the user. This setting allows for various policies and network designs. Clients from behind a firewall are able to send mail to any Internet address without directly connecting to the Internet. End-users directly connected to the Internet can use the services of an e-mail provider that is not necessarily the same as their connection provider.
Before SMTP-AUTH was widely implemented, the only practical setting for an end user or small office directly connected to the Internet was to use the connection provider's SMTP server. Nowadays, decent SMTP servers support authentication and encrypted SMTP sessions. Even then, some still believe that using their connection provider’s SMTP server for outgoing mail would result in a better overall resource usage, because that allows to optimize the delivery paths of outgoing messages. After recognizing the amount of resources burned for delivering spam, that statement is not true.
Another choice is whether to use port 25 or port 587, as established by RFC 2476. Many servers support both. Some servers still support port 465 for legacy secure SMTP, it is preferable to use encryption on standard ports after RFC 2487 |