Email

SMTP, IMAP and POP3 Explained

Understand what each email protocol does, which ports to use, and how to choose between IMAP and POP3 without losing messages.

Key takeaways

  • SMTP moves a message toward its destination; IMAP and POP3 let you get at mail that has already arrived.
  • IMAP synchronizes folders and read status across devices, while POP3 is built around downloading to one place.
  • Use port 993 for IMAP, 995 for POP3, and 465 or 587 for sending, always with encryption turned on.
  • Port 25 is for servers exchanging mail with each other, and many home networks block it.
  • Switching from POP3 to IMAP needs care, because older mail may exist only on one computer.

SMTP sends email. IMAP and POP3 retrieve it. When you set up a mail app by hand and it asks for an incoming server and an outgoing server, the incoming one speaks IMAP or POP3 and the outgoing one speaks SMTP.

For most people the choice that matters is IMAP over POP3, because IMAP keeps mail on the server and keeps every device in step. The rest of this guide explains why, which ports and encryption settings to enter, and the cases where the older option still makes sense.

Why there are separate protocols

Sending and reading are different problems. A message in transit has to travel to a server that is expected to be online all the time. Reading happens on devices that are often asleep, offline or brand new.

SMTP solves the first problem by pushing mail from one server to the next. It has no concept of folders, read flags or searching your archive. Retrieval protocols solve the second: they let a client sign in to a mailbox and ask what is there.

Three protocols, three jobs
SMTP Pushes mail toward the recipient Used by apps to submit and by servers to relay No folders or read status IMAP Mail stays on the server Folders and flags sync everywhere Can fetch parts of a message on demand POP3 Downloads messages from one inbox Server folders are not visible Often removes the server copy SMTP Pushes mail toward the recipient Used by apps to submit and by servers to relay No folders or read status IMAP Mail stays on the server Folders and flags sync everywhere Can fetch parts of a message on demand POP3 Downloads messages from one inbox Server folders are not visible Often removes the server copy

SMTP: the sending side

SMTP, defined today in RFC 5321, is a text conversation. The client greets the server, names the sender and each recipient, then transmits the message. The server answers each step with a three-digit code.

SMTP is used in two situations that behave quite differently:

  • Submission. Your mail app hands a new message to your own provider. You must authenticate. This uses port 587 with the STARTTLS command, or port 465 where the connection is encrypted from the first byte.
  • Relay. Your provider's server delivers to the recipient's server on port 25. There is no username and password; the receiver judges the sender by other evidence, such as domain authentication and reputation.

Port 25 is widely blocked for outbound traffic on residential connections and some cloud networks, because infected computers used it to send spam directly. If an old device is configured to send on port 25 and fails, changing to the submission port with authentication is the usual fix.

SMTP also defines the envelope: the MAIL FROM and RCPT TO commands that tell servers where to deliver and where to return failures. The headers you see in a message are part of its content and are not what servers route on.

IMAP: a synchronized mailbox

IMAP, the Internet Message Access Protocol, treats the server as the master copy. Your app is a window onto it. The widely deployed version is IMAP4rev1, and a newer revision, IMAP4rev2, is published as RFC 9051.

What that gives you:

  • Folders that look the same on your phone, laptop and tablet.
  • Flags such as read, replied and flagged that follow the message.
  • The ability to download headers first and fetch a large attachment only when you open it.
  • Server-side searching, so a new device can find old mail without holding all of it.
  • An IDLE command that lets the server notify a connected client about new mail without constant polling.

The cost is that your mailbox counts against server storage, and that deleting on one device deletes everywhere. That second point surprises people who tidy up a phone to save space. To save space on a device, reduce how many days of mail it syncs rather than deleting.

POP3: download and keep locally

POP3, the Post Office Protocol, is described in RFC 1939. It is intentionally small. A client signs in, lists the messages in the inbox, downloads them and optionally deletes them from the server.

POP3 knows only the inbox. Folders you create in your app exist only on that computer, and sent mail is stored locally too. Most clients offer a "leave a copy on the server" setting, often with a time limit, which lets a second device see recent mail. Read status still does not synchronize.

POP3 still fits a few cases:

  • You want one computer to hold the permanent archive and keep server storage nearly empty.
  • A scanner, script or line-of-business program only supports POP3 for collecting incoming messages.
  • You are pulling mail from an account for a one-time collection.

If you choose it, the local disk becomes the only home for that mail, so it needs real backups. Backing up and exporting email covers formats and methods.

Ports and encryption settings

Purpose Protocol Port Encryption setting
Incoming, synced IMAP 993 SSL/TLS
Incoming, synced (older style) IMAP 143 STARTTLS
Incoming, download POP3 995 SSL/TLS
Incoming, download (older style) POP3 110 STARTTLS
Sending from an app SMTP submission 465 SSL/TLS
Sending from an app SMTP submission 587 STARTTLS
Server to server SMTP 25 STARTTLS when offered

"SSL/TLS" in a settings menu means the connection is encrypted immediately. "STARTTLS" means it begins in plain text and upgrades before anything sensitive is sent. RFC 8314 recommends the encrypted-from-the-start ports for apps. Either is acceptable when your app is set to require encryption. Avoid any option labeled "none" or "use encryption if available".

You can confirm a server is reachable and presents a certificate with a command such as this, on a system with OpenSSL installed:

openssl s_client -connect imap.example.com:993 -servername imap.example.com

For SMTP with STARTTLS:

openssl s_client -starttls smtp -connect smtp.example.com:587

On Windows, Test-NetConnection smtp.example.com -Port 587 in PowerShell checks only whether the port opens. Ports themselves are explained in how ports let one computer run many services.

Signing in: passwords, app passwords and tokens

The protocols were created in an era of simple usernames and passwords. Many providers now require a modern sign-in flow based on OAuth, where your app opens the provider's own login page and receives a limited token. That allows two-factor authentication to work and means the app never stores your main password.

Older apps that cannot do this may need an app password, a long random string generated in your account settings and used for that one program. Some providers have switched off basic password sign-in entirely, and some disable IMAP or POP3 until you enable it. Menu names and policies vary, so check your provider's help pages.

What the conversations look like

Seeing the commands once makes error messages less mysterious. An IMAP client labels each command with a tag, so replies can be matched to requests even when several are in progress:

C: a1 LOGIN [email protected] (secret)
S: a1 OK LOGIN completed
C: a2 SELECT INBOX
S: * 42 EXISTS
S: a2 OK [READ-WRITE] SELECT completed
C: a3 FETCH 42 (FLAGS BODY.PEEK[HEADER])
S: * 42 FETCH (...)
S: a3 OK FETCH completed

A POP3 session is shorter and has no folders to select:

S: +OK ready
C: USER [email protected]
S: +OK
C: PASS (secret)
S: +OK
C: STAT
S: +OK 3 12480
C: RETR 1
S: +OK (message follows)
C: DELE 1
S: +OK marked for deletion
C: QUIT
S: +OK bye

You would only type these by hand when testing your own server, and modern services often require a token instead of a plain login. Still, a client log full of lines like these tells you whether a failure happened at connection, sign-in, folder selection or download.

Which should you use?

Choosing how to get your mail
Do you read mail on more than one device or on the web? YES Use IMAP, or the provider's own app, so everything stays in step. 1 NO Does your work or school require a specific system? YES Use the account type they document, such as Exchange. 2 NO Must a single machine keep the only archive? YES POP3 can work. Set up backups first. 3 NO Default to IMAP It is the safer general choice and easy to change from later. Do you read mail on more than one device or on the web? 1 IF YES Use IMAP, or the provider's own app, so everything stays in step. NO Does your work or school require a specific system? 2 IF YES Use the account type they document, such as Exchange. NO Must a single machine keep the only archive? 3 IF YES POP3 can work. Set up backups first. NO Default to IMAP It is the safer general choice and easy to change from later.

You may also see Exchange, ActiveSync, JMAP or a provider-specific account type. Exchange-style accounts synchronize calendars and contacts along with mail. JMAP is a newer open standard (RFC 8620 and RFC 8621) that uses structured web requests, with support depending on the provider and client.

Moving from POP3 to IMAP safely

This is where mail gets lost, so go in order.

  1. Back up the local mail from your current app before changing anything.
  2. Add the account again as IMAP, alongside the old POP3 account. Do not remove the old one yet.
  3. Wait for the new account to finish its first synchronization.
  4. Drag local folders from the POP3 account into the IMAP account in batches, and watch for upload errors or storage limits.
  5. Compare message counts on webmail and in the app.
  6. Remove the old account only after you have verified the copies, and keep the backup.

What can go wrong

  • Sending works, receiving fails, or the reverse. The incoming and outgoing servers have separate settings. Check the one that fails.
  • Authentication errors with the right password. The provider may require OAuth or an app password.
  • Certificate warnings. The server name you typed must match a name on the certificate. Use the hostname your provider publishes.
  • Sent mail missing on other devices. The app is saving sent items locally. Point its Sent folder at the server's Sent folder.
  • Duplicates after a change. POP3 clients track which messages they have fetched; resetting an account can make them download everything again.

If the basics are new to you, how email works from send to inbox shows where each protocol sits in the full journey, and setting up email on a new device walks through the screens you will meet.

Written for 4Internet with AI writing tools and not reviewed line by line by a person. Check anything you rely on with the maker, provider or standard concerned. Report an error.

Keep reading

All 45 articles in Email →

Latest news on this topic