Setting up a mail server requires understanding the three core protocols involved: SMTP for sending, and IMAP or POP3 for retrieving messages. This guide explains each, their differences, and when to use them.
SMTP (Simple Mail Transfer Protocol)
SMTP is used exclusively for sending email — from a client to a server, and between mail servers relaying messages across the internet.
| Port | Purpose |
|---|---|
| 25 | Server-to-server relay (often blocked by residential ISPs and some hosts by default) |
| 465 | SMTP over implicit SSL/TLS |
| 587 | SMTP submission with STARTTLS (recommended for client sending) |
IMAP (Internet Message Access Protocol)
IMAP synchronizes email across multiple devices — messages stay on the server, and any action (read, delete, move to folder) is reflected everywhere you check that account.
| Port | Purpose |
|---|---|
| 143 | Standard IMAP (unencrypted, avoid in production) |
| 993 | IMAP over SSL/TLS (recommended) |
POP3 (Post Office Protocol)
POP3 downloads email to a single device, typically removing it from the server afterward (unless configured to leave a copy) — no cross-device synchronization.
| Port | Purpose |
|---|---|
| 110 | Standard POP3 (unencrypted, avoid in production) |
| 995 | POP3 over SSL/TLS (recommended) |
Comparison
| Feature | SMTP | IMAP | POP3 |
|---|---|---|---|
| Purpose | Send mail | Access & sync mail | Download mail |
| Stores on server | N/A | Yes | Usually no (after download) |
| Multi-device sync | N/A | Yes | No |
How They Work Together
- You compose an email; your client sends it via SMTP
- The recipient's mail server receives it via SMTP
- The recipient retrieves it using IMAP (synced across devices) or POP3 (downloaded to one device)
Setting Up Your Own Mail Server
A complete self-hosted mail server typically requires:
- An MTA (Postfix) handling SMTP — see How to Install and Configure Postfix as a Mail Transfer Agent
- An IMAP/POP3 server (Dovecot) for retrieval — see How to Install and Configure Dovecot for IMAP/POP3
Which Should You Choose for Retrieval?
IMAP is almost always the better choice today — it keeps mail synchronized across phone, webmail, and desktop clients. POP3 remains relevant mainly for simple single-device setups or specific archival workflows.
FAQ
Can SMTP receive email?
No — SMTP handles only outgoing/relay delivery; retrieving messages always requires IMAP or POP3.
Should I always use encrypted ports?
Yes — always use 587/465 for SMTP and 993/995 for IMAP/POP3 in production; the unencrypted legacy ports (25 client submission, 143, 110) expose credentials and content in plaintext.
Related Articles
- How to Install and Configure Postfix as a Mail Transfer Agent
- How to Install and Configure Dovecot for IMAP/POP3
- How to Set Up a Complete Mail Server (Postfix + Dovecot + SPF/DKIM/DMARC)
