ELEC3506

Topics

Application LayerLecture 8 PDF15 min

Electronic mail

Why email needs intermediate servers, the three agents (UA, MTA, MAA), how SMTP pushes mail, how POP3 and IMAP4 pull it, and how web-based mail combines HTTP with SMTP.

By the end of this page you should be able to

  • Explain why email cannot use a simple one-step client-server design
  • Name the user agent, message transfer agent and message access agent and say what each does
  • State which protocol is a push protocol and which are pull protocols
  • Compare POP3 and IMAP4 by what the user can and cannot do on the server
  • Say which protocol is used on each hop of web-based mail

The idea

A web server is always running because the whole point of it is to answer. Your laptop is not. If a friend sends you a message while the laptop is asleep, nothing can deliver it directly. So email puts servers in the middle that are always on. They accept the message, hold it, and let the recipient collect it whenever they like.

That one fact explains the odd shape of the email system: several programs, and a different protocol for sending than for collecting.

How it works

Why email is different

The lecture contrasts email with HTTP and FTP in three points:

  • No immediate response is required.
  • It is infeasible for email recipients to run a server program and wait until someone sends an email.
  • The client-server idea therefore has to be implemented using some intermediate servers.

How it works

Components

There are three kinds of software in the email system.

  • User agent (UA): composes, reads, replies to and forwards messages.
  • Message transfer agent (MTA): transfers messages from one computer to another.
  • Message access agent (MAA): accesses messages.

The system requires two UAs, two pairs of MTAs (client and server) and a pair of MAAs (client and server).

Aside

The architecture diagram is missing

The slide titled “Electronic Mail System Architecture” is a figure only, and nothing from it extracted. The component list above comes from the preceding slide, which states the counts directly. The diagram itself is not described here.

How it works

Protocols used

Email needs three uses of the client-server paradigm.

  • The MTA protocol is SMTP (Simple Mail Transfer Protocol). It is a push protocol: the message is pushed from client to server. SMTP is used two times.
  • The MAA protocol needs pull protocols: the message is pulled by the client from the server. The lecture names POP3 (Post Office Protocol, version 3) and IMAP4 (Internet Mail Access Protocol, version 4).

How it works

SMTP

SMTP defines how commands and responses are sent between the MTA client and server. It uses a TCP connection on well-known port 25. A transfer has three phases:

  1. Connection establishment (handshaking)
  2. Transfer of messages
  3. Connection termination

Commands go from client to server as ASCII text. Responses go from server to client as a status code and phrase. Messages must be in 7-bit ASCII.

How it works

POP3 and IMAP4

POP3 is simple but limited:

  • The user cannot organise mail on the server.
  • The user cannot have different folders on the server.
  • The user cannot partially check the contents of a mail before downloading.

IMAP4 is more powerful and more complex, with extra functions:

  • The user can check the email header prior to downloading.
  • The user can partially download an email.
  • The user can create, delete or rename mailboxes on the mail server.
  • The user can create a hierarchy of mailboxes in a folder for email storage.
POP3IMAP4
PowerSimple but limited functionalityMore powerful and more complex
Check header before downloadNoYes
Partial downloadNoYes
Folders and mailboxes on serverNoCreate, delete, rename, and nest in a hierarchy
DirectionPullPull
Both are message access protocols that pull mail from the server.

How it works

Web-based mail

With web-based mail, Alice sends the message to her web server using HTTP transactions, and Bob receives the message using HTTP transactions. The message from Alice’s server to Bob’s server still uses SMTP.

Where marks get lost

Do not answer “HTTP” for a question about web-based mail unless you also name SMTP. HTTP replaces the user-side access protocol on each end. The hop between the two mail servers is SMTP in every case.

Aside

SMTP and 7-bit ASCII

The lecture states that messages must be in 7-bit ASCII, and that is the answer to give. This page did not check the SMTP RFCs for extensions that relax it, because the lecture does not cover them. If you meet a question about sending binary attachments, the slides give no guidance.

In the exam

  • Components: UA, MTA, MAA. Know the counts: two UAs, two pairs of MTAs, one pair of MAAs.
  • Push versus pull: SMTP is push and is used two times. POP3 and IMAP4 are pull.
  • SMTP facts: TCP port 25, three phases, ASCII commands, status code and phrase responses, 7-bit ASCII messages.
  • POP3 versus IMAP4: a list of what each can and cannot do. Give all four IMAP4 abilities.
  • Web-based mail: HTTP on the user side, SMTP between servers.

Check yourself

  • Email uses intermediate servers because recipients cannot run a server and wait.
  • UA composes and reads, MTA transfers, MAA accesses.
  • SMTP pushes on TCP port 25 in 7-bit ASCII. POP3 and IMAP4 pull.
  • IMAP4 adds header preview, partial download and mailbox management that POP3 lacks.
  • Web-based mail uses HTTP at the ends and SMTP between the servers.

Check yourself

  1. Which protocol is used to push a message from the sender towards the recipient?
  2. A user wants to read only the headers of new mail before deciding what to download. Which protocol supports that?
  3. What TCP port does SMTP use?
  4. Alice and Bob both use web-based mail. Which protocols carry the message from end to end?
  5. Which of these can a POP3 user do on the server?