Simple Mail Transfer Protocol
aliases:
SMTP
Application protocol used to send mail between hosts on the internet.
SMTP uses 25/tcp for messages between mail servers. The sender's SMTP server discovers the recipient's SMTP server using the domain name part of the recipient's email address (i.e. the liltable.dev in mail@liltable.dev).
The SMTP servers for a domain are registered in a DNS server using the mail exchange (MX) records and the host (A/AAAA) records.
Message Queueing
Not infinite. If there's an issue, the SMTP server keeps retrying for a set amount of attempts. When that has been exhausted, it sends a non-delivery report (NDR) to the sender, containing an error code that explains why the mail couldn't be sent.
SMTP also doesn't have persistent storage of messages.
Encryption
SMTP communications can be encrypted using TLS. It's similar to HTTPS, using a certificate installed on the SMTP server and negotiating the usage of a cipher suite to use with a connecting client. While TLS Explicit Mode is supported with the use of STARTTLS, Implicit Mode is preferred since it establishes the secure connection before any SMTP commands are sent.
465/tcp is used for secure mail submission using Implicit Mode. 587/tcp is used for secure mail submission using Explicit Mode.
Delivery Process
- Client submits a message to be sent.
- Message contents are formatted and the relevant files are stored on the local IMAP server.
- Local SMTP server asks the DNS server for the IP address of the recipient's mail server.
- Local SMTP server connects to the recipient's mail server over
25/tcp. - If the message is accepted by the remote mail server, the message files are copied from the local IMAP server to the recipient's mail server.
- The recipient uses it's preferred client to read the message.