Application Layer · Computer Networks

Electronic Mail (EMAIL)

Watch lectures
SVGVector Architecture Diagram (SVG)
COMPUTER NETWORKS · Module 5 · Application Layer★ High PriorityIT Sem 6 · Code 100602Electronic Mail (E-mail)MNEMONICSMTP = Send (push) · POP3 / IMAP = Pick up (pull).Path: Sender UA → MTA → MTA → MAA → Receiver UA.Core BreakdownArchitectureThree agents: User Agent (UA, the mail client), Message Transfer Agent (MTA, SMTP server),Message Access Agent (MAA, POP3 / IMAP). Mail is stored in the receiver's mailbox.Mail FlowSender UA → sender's MTA → (SMTP over the Internet) → receiver's MTA → mailbox → MAA → receiver UA.Two SMTP hops push the mail; the last hop (MAA) is a pull by the receiver.SMTPPush protocol over TCP. Port 25 = server-to-server relay; 587 = authenticated submission (TLS).Commands are ASCII; replies are 3-digit codes: 220 ready, 250 OK, 354 start mail input, 550 unavailable.SMTP DialogServer 220 ready → EHLO → MAIL FROM → RCPT TO → DATA (354) → message + '.' alone on a line → 250 → QUIT.Commands: HELO / EHLO, MAIL FROM, RCPT TO, DATA, QUIT.Message FormatEnvelope (sender + receiver addresses) + Message.Message = Header (From, To, Subject, Date) + blank line + Body (the text).MIMEMIME converts non-ASCII / binary data to 7-bit ASCII (Base64: 3 bytes become 4 ASCII characters).Headers: MIME-Version, Content-Type (text/html, image/jpeg, multipart/mixed), Content-Transfer-Encoding.POP3Pull protocol, TCP port 110 (995 with SSL). Simple, downloads mail to one computer.Delete mode removes mail from the server after download; keep mode leaves a copy.IMAP4Pull protocol, TCP port 143 (993 with SSL). Mail stays on the server: folders, search, partial download,sync across many devices. More powerful (and more complex) than POP3.Diagram: E-mail ArchitectureSenderUser Agent (UA)SenderMail Server (MTA)Receiver MTA+ MailboxReceiverUser Agent (UA)SMTPSMTPPOP3 / IMAPpushpushpullMessage format:Header: From, To, Subject, Date(blank line)Body: the message textSMTP: TCP port 25, push, ASCII commands (HELO, MAIL FROM, RCPT TO, DATA, QUIT)POP3: download + delete (one device) | IMAP: mail stays on server, folders, syncMIME: sends non-ASCII / binary data (images, audio) as 7-bit ASCII⚠️ Exam Traps & Viva Favorites① SMTP vs POP3 / IMAP?SMTP only PUSHES mail (client → server).It cannot retrieve mail. Retrieval needsa Message Access Agent: POP3 or IMAP.② Why do we need MIME?SMTP carries only 7-bit ASCII text.MIME encodes binary / non-English datainto ASCII and decodes it at the receiver.③ POP3 vs IMAP4?POP3: download and (usually) delete; simple.IMAP4: mail stays on the server, folders,sync across multiple devices.Tip: SMTP pushes · POP3/IMAP pullMaster Revision Table(learn it row by row!)ProtocolRolePortDirectionPitfallSMTPTransfers mail between MTAsTCP 25 / 587Push (client → server)Cannot retrieve mailPOP3Downloads mail to one deviceTCP 110 / 995Pull (download)Deletes server copy by defaultIMAP4Manages mail on the serverTCP 143 / 993Pull (sync, folders)Uses more server storageMIMEEncodes non-ASCII as ASCIINo port (extension)Extends SMTPNot a transport protocolHTTP (web mail)Browser access to mailboxTCP 80 / 443Browser ↔ serverServer-to-server still uses SMTPQUICK FACTSPorts: SMTP 25 (submission 587, legacy SMTPS 465) · POP3 110 · IMAP4 143Secure variants: POP3S 995 · IMAPS 993Push = SMTP · Pull = POP3 / IMAP4 · Binary → ASCII = MIMEVERIFIED★ Golden rule: SMTP pushes, POP3 / IMAP pull, MIME fits binary data into ASCII.

Electronic Mail (EMAIL) Architecture and Protocols


1. Architectural Components of Email Systems

The Internet Electronic Mail (EMAIL) system consists of three architectural components operating in concert:

MermaidDiagram
Rendering diagram…
  1. User Agent (UA): Client application program that allows the user to read, compose, reply to, and forward email messages (e.g., MS Outlook, Thunderbird, Apple Mail).
  2. Message Transfer Agent (MTA): Server software responsible for transferring and relaying messages across the Internet using SMTP (e.g., Postfix, Sendmail, Exim).
  3. Message Access Agent (MAA): Protocols used by the receiving client to retrieve stored messages from the remote mailbox (POP3 or IMAP4).

2. Simple Mail Transfer Protocol (SMTP)

SMTP (RFC 5321) is a connection-oriented Push Protocol used to transfer messages from the sender's UA to the local mail server, and between mail servers across the Internet.

Transport Ports:

  • TCP Port 25: Standard port for Server-to-Server (MTA-to-MTA) relaying.
  • TCP Port 587: Modern authenticated Message Submission (UA-to-MTA) with mandatory TLS encryption.
  • TCP Port 465: Legacy SMTPS (SMTP over SSL).

Standard SMTP Dialog Exchange:

MermaidDiagram
Rendering diagram…

3. Multipurpose Internet Mail Extensions (MIME)

The original SMTP standard (RFC 821) was strictly limited to 7-bit ASCII characters, making it impossible to transmit rich text, accented European characters, Asian languages, or binary attachments (images, PDFs, audio).

MIME (RFC 2045) solves this by defining headers that convert non-ASCII and binary data into 7-bit ASCII bitstreams:

MermaidDiagram
Rendering diagram…

Key MIME Headers:

  • MIME-Version: Specifies MIME standard version (e.g., 1.0).
  • Content-Type: Declares the media format of the payload:
    • Text: text/plain, text/html.
    • Image: image/jpeg, image/png.
    • Application: application/pdf, application/octet-stream.
    • Multipart: multipart/mixed (combines body text with file attachments).
  • Content-Transfer-Encoding: Declares the encoding algorithm used (e.g., base64, quoted-printable).

4. Mail Access Protocols: POP3 vs. IMAP4

Because an end user's personal laptop or smartphone is not connected to the Internet 24/7 with a static public IP, incoming email must be received and stored on a central mail server. The user then pulls the mail down via an MAA protocol:

MermaidDiagram
Rendering diagram…

1. POP3 (Post Office Protocol Version 3 - RFC 1939):

  • Download and Delete: Downloads all emails from the server to the client computer's local hard drive and deletes them from the server.
  • Limitation: If you download an email on your work computer, it is no longer available when you check your smartphone later!

2. IMAP4 (Internet Message Access Protocol Version 4 - RFC 3501):

  • Client-Server Synchronization: Emails permanently reside on the remote server. The client downloads only message headers, retrieving message bodies and attachments on demand.
  • Hierarchical Folders: Folders created, renamed, or organized on a smartphone are instantly synchronized to all other devices.
  • Server-Side Searching: Allows searching large mail archives on the server without downloading gigabytes of email locally.

5. Comprehensive Protocol Comparison

Parameter SMTP POP3 IMAP4
Role Mail Transmission / Relay Mail Retrieval Mail Retrieval & Sync
Direction Push (Client →\rightarrow Server) Pull (Server →\rightarrow Client) Pull (Server →\rightarrow Client)
Default Port TCP 25 (MTA), 587 (TLS) TCP 110 (Plain), 995 (SSL) TCP 143 (Plain), 993 (SSL)
Storage Model Ephemeral queue in transit Local storage on client PC Centralized server storage
Multi-Device N/A Very poor (No synchronization) Perfect synchronization
Partial Fetch Sends full message Downloads whole message Can fetch headers / parts only

Frequently Asked Questions

QWhy is SMTP called a "Push" protocol while POP3 and IMAP4 are "Pull" protocols?

SMTP initiates the connection to push outgoing email from the sender to the mail server and between servers. POP3 and IMAP4 are initiated by the recipient client to pull stored email from the remote mailbox down to the local user interface.

QWhat is the function of MIME in email?

MIME extends the original 7-bit ASCII limitation of SMTP, allowing users to send binary files, rich multimedia, and international character sets by encoding them into ASCII text using algorithms like Base64.

QState two major advantages of IMAP4 over POP3.

IMAP keeps all messages synchronized across multiple client devices in real-time, and supports server-side folder management and partial downloads of message headers.

QWhich ports do SMTP, POP3 and IMAP4 use?

SMTP uses TCP 25 (server-to-server) and 587 (authenticated submission with TLS). POP3 uses 110 (plain) / 995 (SSL). IMAP4 uses 143 (plain) / 993 (SSL).

Student FinanceWeb Platform

Pocketly — Personal Finance for Students

Keep your hostel and college expenses under control. Track accounts, log spending in seconds, and stay within your monthly budget.

← All Computer Networks modules