Browser and Apache Web Server Architecture · Web Technology

SMTP (Simple Mail Transfer Protocol)

1. Definition

SMTP (RFC 5321) is the application-layer protocol used to send and relay e-mail across the Internet — from a mail client to a mail server, and between mail servers. Transport: TCP port 25 (server-to-server relay & submission), 587 (client submission with STARTTLS), 465 (implicit SSL submission).

2. Mail System Architecture

 sender UA          sender MTA                receiver MTA          receiver UA
 +--------+  SMTP   +----------+    SMTP     +-----------+   POP3/IMAP  +--------+
 | Outlook|-------> | mail.abc |-----------> | mail.xyz  |<------------ | Outlook|
 | compose| port587 |  .com    |  port 25    |  .com     |  110/143     | inbox  |
 +--------+         +----------+             +-----------+              +--------+
                        |  stores outgoing queue (spool) | stores mailbox

Components: UA (user agent) composes/reads mail; MTA (mail transfer agent) — Sendmail, Postfix, Exchange — accepts and forwards; mailbox stores delivered mail until the user retrieves it with POP/IMAP. SMTP is a push protocol (sends mail toward the mailbox server); POP/IMAP are pull protocols (client fetches).

3. SMTP Session / Commands

Command Purpose
HELO / EHLO Greet the server (EHLO = extended SMTP, lists extensions)
MAIL FROM:<a@x.com> Envelope sender
RCPT TO:<b@y.com> Envelope recipient (repeatable)
DATA Start message content; ends with a line containing a single .
RSET, NOOP, VRFY, HELP Reset, no-op, verify address, help
QUIT End session

Replies: 220 service ready, 250 OK, 354 start mail input, 550 no such user, 421 service unavailable.

4. Example Transaction

 S: 220 mail.xyz.com ESMTP ready
 C: EHLO mail.abc.com
 S: 250-mail.xyz.com ... 250 STARTTLS
 C: MAIL FROM:<ramesh@abc.com>
 S: 250 OK
 C: RCPT TO:<suresh@xyz.com>
 S: 250 OK
 C: DATA
 S: 354 End data with <CR><LF>.<CR><LF>
 C: From: ramesh@abc.com
 C: To: suresh@xyz.com
 C: Subject: Meeting
 C:
 C: Please attend the review at 4 PM.
 C: .
 S: 250 OK: queued as 4F2X
 C: QUIT
 S: 221 Bye

5. Message Format (RFC 5322) & MIME

Message = envelope (SMTP commands) + headers (From, To, Cc, Subject, Date, Reply-To, Message-ID) + body. MIME extends SMTP for attachments/multi-media: MIME-Version, Content-Type (multipart/mixed), Content-Transfer-Encoding (base64, quoted-printable).

6. Features and Limitations

Features: simple text commands; end-to-end and store-and-forward relay via MX DNS records; supports multiple recipients; ESMTP extensions (STARTTLS, AUTH, SIZE, DSN).

Limitations / weaknesses:

  • No built-in encryption (plain text) → mitigated by STARTTLS or SSL wrappers.
  • No built-in authentication → spam and spoofing; countered by SPF, DKIM, DMARC, greylisting, spam filters.
  • No mailbox retrieval — SMTP only delivers (that's POP/IMAP's job).
  • 7-bit ASCII base historically; MIME solves binary content.

7. Exam Points

  • Explain the SMTP mail architecture (UA, MTA, MX relay, push vs pull) with a diagram — 10 marks (very frequent).
  • Explain SMTP commands and simulate a session (EHLO → MAIL FROM → RCPT TO → DATA → QUIT) — 7 marks.
  • Limitations of SMTP and how spam/TLS mitigate them — 5 marks.
  • Compare SMTP, POP3 and IMAP — 5 marks.
Free AppAndroid App

Coursify Android App

Generate AI courses, take quick quizzes between classes, and master complex engineering concepts on the go.

← All Web Technology modules