SMTP (Simple Mail Transfer Protocol) is the protocol for sending email. Your mail app uses it to submit messages to your provider (port 587 or 465), and mail servers use it to deliver messages to each other (port 25). Receiving mail in your app uses IMAP or POP instead.
How it works
The journey of an email
- Submission: your mail app connects to your provider's SMTP server on port 587 (STARTTLS) or 465 (TLS), logs in, and hands over the message.
- Lookup: your provider looks up the recipient domain's MX records to find its mail servers.
- Relay: it connects to the recipient's MX server on port 25 and delivers the message, server to server.
- Checks: the receiving server checks SPF, DKIM and DMARC to decide whether the message is genuine, then files it in the inbox or spam.
- Reading: the recipient's app fetches it with IMAP (port 993) or POP (port 995).
An SMTP conversation
SMTP is a text protocol: commands like EHLO, MAIL FROM, RCPT TO and DATA, answered with numeric codes such as 250 OK or 550 mailbox unavailable. Bounce messages quote these codes.
IMAP vs POP
IMAP keeps mail on the server and syncs it across devices; POP downloads and usually removes it. Use IMAP unless you have a specific reason.
Side by side
| Port | Use | Encryption |
|---|---|---|
| 25 | Server-to-server delivery | STARTTLS (opportunistic) |
| 587 | Mail app submission | STARTTLS, required |
| 465 | Mail app submission | TLS from the start |
| 993 | IMAP (reading) | TLS |
| 995 | POP (reading) | TLS |
Examples
iCloud Mail's outgoing server is smtp.mail.me.com on port 587; incoming is imap.mail.me.com on 993.
dig gmail.com MX +short shows where Gmail receives mail:
5 gmail-smtp-in.l.google.com.
10 alt1.gmail-smtp-in.l.google.com.
On a Mac
Apple Mail shows each account's SMTP settings in Mail › Settings › Accounts › Server Settings (Outgoing Mail Account). If sending fails but receiving works, check that the network doesn't block 587 or 465, and that the account's password hasn't changed. nc -vz smtp.mail.me.com 587 tests whether the port is reachable.
See it in the app
LightAtom's connections view shows Mail's connections to your provider: IMAP on 993 for reading, SMTP on 587 or 465 when sending.
Frequently asked questions
What is SMTP used for?
Sending email: from your mail app to your provider and from one mail server to another. Receiving mail in your app uses IMAP or POP.
What is the difference between SMTP and IMAP?
SMTP sends mail; IMAP lets your app read and organise mail stored on the server.
Which SMTP port should I use?
587 with STARTTLS, or 465 with TLS, for sending from an app. Port 25 is for mail servers and is often blocked on home connections.
What is an SMTP server?
A server that accepts outgoing mail and delivers it. Your email provider runs one for you, and receiving domains run MX servers that accept incoming mail.