Back to the 2021 paper

Module 5: Application Layer & Security

202114m

Differentiate between POP3 and IMAP4. Suppose Alice, with a Web-based e-mail account (such as Hotmail or Gmail), sends a message to Bob, who accesses his mail from his mail server using POP3. Discuss how the message gets from Alice's host to Bob's host. Be sure to list the series of application-layer protocols that are used to move the message between the two hosts.

Worked SolutionAI Assisted

POP3 vs IMAP4 and Delivery of E-mail

Part A — POP3 vs IMAP4

Aspect POP3 (RFC 1939) IMAP4 (RFC 3501)
Full form Post Office Protocol version 3 Internet Message Access Protocol version 4
Basic model Download-and-delete (default) or download-and-keep Messages remain on the server; the client manipulates the server's copy
Server-side storage Mailbox is emptied after retrieval → mail stored on one machine All mail retained on the server; folders, flags and read state kept server-side
Client access Effectively one client at a time (mailbox is locked) Many clients/devices can access the same mailbox simultaneously
Operations Simple: USER, PASS, LIST, RETR, DELE, STAT, QUIT Rich: LOGIN, SELECT, FETCH, STORE, SEARCH, CREATE/DELETE, EXPUNGE, NOOP
Folders Not supported (flat mailbox) Multiple folders supported, created/deleted on the server
Partial download No — a whole message must be fetched Yes — headers only, byte ranges, individual MIME parts
Server-side search No Yes (SEARCH)
Default ports 110 (cleartext), 995 (TLS) 143 (cleartext), 993 (TLS)
Typical use Simple offline reading, low server load Webmail, smartphones, sync across devices
Authentication USER/PASS (cleartext unless TLS) LOGIN or SASL (CRAM-MD5, OAuth2, …)

Both protocols are used only to retrieve mail from the user's own mailbox; moving a message between hosts is always done by SMTP.

Part B — How Alice's message reaches Bob

Application-layer protocols used, in order: HTTPS (HTTP) → DNS → SMTP (possibly several hops) → POP3 or IMAP4.

  1. Alice composes the message in her web-based account (Gmail/Hotmail). Since she uses a browser, the message is uploaded to her provider's web server using HTTP over TLS (HTTPS), port 443. (With an installed mail client she would instead submit it with SMTP on port 587.)
  2. Alice's mail server (originating MTA) takes the message. Before sending, it queries DNS for Bob's domain MX record (then an A/AAAA record) to learn the address of Bob's mail exchanger — mail cannot be delivered without this lookup.
  3. SMTP transfer: Alice's server opens a TCP connection to Bob's mail server on port 25 and runs SMTP — HELO/EHLO → MAIL FROM → RCPT TO → DATA → QUIT — handing over the envelope and the message. If Bob's server is down, the message is queued and retried.
  4. Possible relays: the message may pass through one or more intermediate mail servers, each forwarding it with SMTP, until it reaches Bob's mail server (destination MTA), which accepts it and appends the message to Bob's mailbox.
  5. Bob retrieves the mail with a mail client that logs into his own server using POP3 (110/995) or IMAP4 (143/993): USER/PASS (or LOGIN), LIST, then RETR (POP3) or FETCH (IMAP4), followed by QUIT. Under POP3 the message is normally deleted from the server after download; under IMAP4 it stays on the server.
 Alice's host        Alice's mail server      DNS server        Bob's mail server     Bob's host
 (web browser)       (webmail provider)                          (Bob's domain)        (mail client)
      |                      |                     |                     |                   |
      | 1 HTTPS (443)        |                     |                     |                   |
      |   compose + send     |                     |                     |                   |
      |--------------------->|                     |                     |                   |
      |                      | 2 DNS query: MX for bob.com              |                   |
      |                      |-------------------->|                     |                   |
      |                      | 3 MX answer: mail.bob.com                |                   |
      |                      |<--------------------|                     |                   |
      |                      | 4 SMTP (25): EHLO / MAIL FROM / RCPT TO / DATA               |
      |                      |---------------------------------------->|                   |
      |                      |                     |                     | 5 message stored  |
      |                      |                     |                     |   in Bob's mailbox|
      |                      |                     |                     |                   |
      |                      |                     |                     | 6 POP3 (110/995)  |
      |                      |                     |                     | or IMAP4 (143/993)|
      |                      |                     |                     |<------------------|

Series of application-layer protocols: HTTP/HTTPS (Alice → her provider), DNS (MX lookup), SMTP (Alice's server → Bob's server, possibly several relays), and POP3 or IMAP4 (Bob's server → Bob's client) — all carried over TCP/IP beneath them.

Similar questions

Budget AppAndroid App

Pocketly on Android

Log daily food, travel, and hostel expenses instantly. Set monthly spending limits and see where your money goes without complex spreadsheets.