How Email Actually Works
Email is one of the oldest internet services, and it relies on three main protocols: SMTP, POP3, and IMAP. Each handles a different part of the email process โ sending, retrieving, and managing.
SMTP (Simple Mail Transfer Protocol)
SMTP is used for sending email. When you click "Send" in your email client, SMTP handles the delivery from your client to the mail server, and between mail servers across the internet.
You โโSMTPโโโ Your Mail Server โโSMTPโโโ Recipient's Mail Server
(Port 587 or 25)
SMTP is a text-based protocol, similar to HTTP. A simple SMTP conversation looks like:
Client: EHLO example.com
Server: 250-Hello
Client: MAIL FROM:<alice@example.com>
Server: 250 OK
Client: RCPT TO:<bob@gmail.com>
Server: 250 OK
Client: DATA
Server: 354 Start mail input
Client: Subject: Hello!
Client: Hi Bob, how are you?
Client: .
Server: 250 OK: Message queued
SMTP only handles outgoing mail. To retrieve mail, you need POP3 or IMAP.
POP3 (Post Office Protocol v3)
POP3 is used for retrieving email from a mail server. It works like a post office โ your email client connects, downloads all new messages, and (usually) deletes them from the server.
Your Device โโPOP3โโโ Mail Server
(Port 110)
- Advantage: Simple and fast. Downloads messages for offline reading.
- Disadvantage: Messages are typically removed from the server. If you check email on multiple devices, only the first device gets the messages.
POP3 is largely outdated. Most people now use IMAP.
IMAP (Internet Message Access Protocol)
IMAP is used for managing email on the server. Instead of downloading messages, IMAP keeps them on the server and syncs changes across all your devices.
Your Phone โโIMAPโโโ Mail Server โโโIMAPโโ Your Laptop
(Port 143 or 993 with TLS)
- Advantage: Messages stay on the server. All devices see the same emails. Folders, flags, and read status are synced.
- Disadvantage: Requires internet connection to read emails. Server storage is limited.
IMAP is the standard for modern email. Gmail, Outlook, Yahoo โ they all use IMAP.
The Complete Email Journey
Alice sends email to Bob:
1. Alice's email client โ SMTP โ Alice's mail server
2. Alice's mail server โ SMTP โ Bob's mail server
3. Bob's mail server stores the email
4. Bob's email client โ IMAP โ Bob's mail server (retrieves email)
Ports:
SMTP: 25 (server-to-server), 587 (client submission)
POP3: 110 (or 995 with TLS)
IMAP: 143 (or 993 with TLS)