Electronic mail
Transparencias adaptadas por:
8thEdition, Global Edition
Carmen Benavides e Isaías García Jim Kurose, Keith Ross
All material copyright 1996-2020 Pearson
J.F Kurose and K.W. Ross, All Rights Reserved 2020
Electronic mail: overview
Introduction
Major components
Application architecture
SMTP
Email access protocols: IMAP, POP
Email address format
Email message format
MIME
Electronic mail
Very popular application in computer networks.
Appeared in the early 1970s and allows users to exchange text based messages.
Initially, it was mainly used to exchange short messages, but over the years its usage
has grown.
Nowadays e-mail has messages with attachments, hyperlinks, HTML-formatted text,
embedded photos and…
e-mail communication is asynchrnous
________
Electronic mail
main components and standards?
application architecture?
Electronic mail: components
Client software, that allows users to easily create and read email
messages
Server software, that allows to efficiently exchange email messages
Protocols, that allow clients and servers to exchange email
messages
A mail address format, pepe.fernandez@unileon.es
A message format, that defines how valid email messages are
encoded
Electronic mail: Client software
User Agent user
agent
a.k.a. “mail reader”
composing, editing, reading,
sending mail messages
outgoing and incoming
messages stored on server
user
agent
user
agent
user user
agent agent
Electronic mail: server software
matilde@ucm.es
user
agent
mail
Server
UCM
c.meizoso@udc.es
Mail servers:
user
mailbox contains incoming messages for user agent
message queue of outgoing (to be sent) mail mail
Server
messages
UDC
mail user
Server agent
UNILEON
j.rolle@udc.es
outgoing message queue
user mailbox user user
agent agent
isaias@unileon.es carmen@unileon.es
Electronic mail: protocol SMTP
user
agent
Simple Mail Transfer Protocol
SMTP
mail
SMTP protocol to send email messages: server
Between user agents and mail servers
Between mail servers
mail user
agent
server
SMTP
Server: receiving mail server
Client: sending mail server mail
user
server agent
outgoing message queue
user mailbox user
user
agent agent
Scenario: Isaías sends message to Matilde
Isaías uses UA to compose message Client side of SMTP server sends
“to” matilde@ucm.es email to UCM mail server
UCM mail server places the
Isaías’s UA sends message to his message in Matilde’s mailbox
mail server (SMTP)
Matilde invokes her user agent to
Message is placed in message read message
queu. Matilde’s UA request her inbox
emails.
mail mail
Server Server
user
UNILEON UCM user
agent agent
SMTP SMTP
isaias@unileon.es Email
matilde@ucm.es
access
protocols
outgoing message queue
user mailbox
Electronic mail: SMTP [RFC 821]
Messages must be in 7-bit ASCII (archaic)
Client-Server model
CLIENT and SERVER sides of SMTP run on every SMTP mail server
Uses TCP to reliably transfer email message from client to server, port 25 and 465 over SSL
Three phases of transfer
handshaking (greeting)
transfer of message
Closure
Command/response interaction (like HTTP, FTP)
commands: ASCII text
response: status code and phrase
Electronic mail: SMTP [RFC 821]
Command/response interaction
Server response: status code (3 digits) and text
Primera cifra indica el éxito/fracaso del comando
2xx -> respuesta positiva
3xx-> respuesta positiva transitoria (la acción no ha terminado)
4xx -> Error temporal (puede volver a solicitar la acción)
5xx -> Error permanente (no repetir la solicitud)
Electronic mail: SMTP [RFC 821]
Command/response interaction
Comands (send by the client): ASCII text
HELO nombre de dominio: saludo tras aceptar connexion, identifica el
origen de la conexión
MAIL FROM: identifica remitente
RCPT TO: indica destinatario
DATA: inicio del mensaje
RSET: aborta la conexión con el servidor SMTP
QUIT: Cierra sesión SMTP
No hay que confundir las cabeceras de los mensajes IMF(Internet Message Format) (from, to,
subject, date, …) con los commandos SMTP
Sample SMTP interaction
Sample SMTP interaction
S:Blue text is the SMTP Server C:Red text is the client
--------------------------------------------------------------------
S: 220 mail.smtp2go.com ESMTP Exim 4.92-S2G Thu, 07 Nov 2019 14:06:46 +0000
C: HELO [10.20.48.78]
S: 250-mail.smtp2go.com Hello [10.20.48.78] pleased to meet you
C: MAIL FROM: <carmen.benavides@unileon.es> BODY=8BITMIME SIZE=719
S: 250 OK
C: RCPT TO:<isaias.garcia@unileon.es>
S: 250 Accepted <isaias.garcia@unileon.es>
C: DATA
S: 354 Enter message, ending with "." on a line by itself
C: To: isaias garcia <isaias.garcia@unileon.es>
C: From: Carmen Benavides_Upleon <carmen.benavides@unileon.es>
C: Subject: Servicios de Internet- clase del 25 de diciembre
C: Date: Thu, 7 Nov 2019 15:06:47 +0100
C: MIME-Version: 1.0
C: Content-Type: text/plain; charset=utf-8;
C: Hola Isaias,
C: El 25 de diciembre toca el tema de Web Services, yo estoy liada ese díia,
C: por favor, ..podrias dar tu la clase?
C: Gracias y un saludo,
C: Carmen Benavides
C: PD: No puedo poner tildes con este teclado
C: .
S: 250 OK Message accepted for delivery
C: QUIT
S: 221 mail.smtp2go.com closing connection
Sample SMTP interaction
Sample SMTP interaction
Application Layer 2-16
Mail access protocols
outgoing message queue
user mailbox
mail mail
Server Server
user
UNILEON UCM user
agent agent
SMTP SMTP
isaias@unileon.es Email
matilde@ucm.es
access
protocols
Mail access protocol: retrieval from server
POP: Post Office Protocol [RFC 1939]: authorization,
download
IMAP: Internet Mail Access Protocol [RFC 1730]: more
features, including manipulation of stored msgs on
server
HTTP ?? gmail, Proton mail, Yahoo! mail, etc.
Mail access protocols
Application Layer
Mail access protocols
Mail access protocols
POP3 protocol
S: +OK POP3 server ready
C: user carmen.benavides
Client needs to download its e-mail S: +OK
from the mailbox on the mail server.
C: pass mysecretpassword
S: +OK user successfully logged on
Open a TCP connection to the server on TCP
port 110. C: list
S: 1 498
authorization phase S: 2 912
client commands: S: .
user: declare username to access C: retr 1
the mailbox S: <message 1 contents>
pass: password
S: .
server responses
C: dele 1
+OK
-ERR C: retr 2
transaction phase S: <message 2 contents>
client commands: S: .
list: list message numbers C: dele 2
and their sizes C: quit
retr: retrieve message by
number S: +OK POP3 server signing off
dele: delete
quit
POP3 (RFC 1939)
Post Office Protocol, version 3
Very simple protocol, so limited functionality
TCP port 110 and 995 over SSL.
Two working modes:
download and delete mode (default mode)
• The mail is deleted from the mailbox
• Bob cannot re-read e-mail if he changes client
• Previous example uses POP3
download-and-keep mode
• The mail remains in the mailbox after retrieval
• the user can reread messages from different machines
Requires user authentication
POP3 is stateless across sessions (folders, ..)
IMAP (RFC 3501)
Internet Mail Transfer Protocol
More complex and more features than POP3
Keeps all messages in one place: at server
Allows user to organize messages in folders
keeps user state across sessions:
names of folders and mappings between message IDs and folder
name
Read/ unread messages
Can obtain just the message header of a message or just one part
of a multipart MIME message
TCP port 143 and 993 over SSL.
Web access
Ubiquitous accessibility
User agent (UA) is embebed in a web browser
The UA uses HTTP to communicate with the Web Server.
The Web Server uses IMAP-POP/SMTP to retrieve/send the emails from
the email server.
Web access
Webmail Access Architectures
Internet mail addressing
Mechanism to express the sender and recipient information of an e-mail
pepe.fernandez@unileon.es
Mail message format
Standard for text message format:
RFC 822 (1982)
RFC 5322 (2008)
Header lines, e.g.: header
To: blank
From: line
Subject:
…
different from SMTP MAIL FROM, body
RCPT TO, commands!
Body: the “message”
ASCII characters only, just text!
Mail message format
--------------------------Connection Establishment------------------------------------
S: 220 mail.smtp2go.com ESMTP Exim 4.92-S2G Thu, 07 Nov 2019 14:06:46 +0000
C: HELO [10.20.48.78]
S: 250-mail.smtp2go.com Hello [10.20.48.78] pleased to meet you
------------------------------------Envelope-------------------------------------------------
C: MAIL FROM: <carmen.benavides@unileon.es> BODY=8BITMIME SIZE=719
S: 250 OK
C: RCPT TO:<isaias.garcia@unileon.es>
S: 250 Accepted <isaias.garcia@unileon.es>
--------------------------------Header and Body------------------------------------------
C: DATA
S: 354 Enter message, ending with "." on a line by itself
C: To: isaias garcia <isaias.garcia@unileon.es>
C: From: Carmen Benavides_Upleon <carmen.benavides@unileon.es>
C:
C:
Subject: Servicios de Internet- clase del 25 de diciembre
Date: Thu, 7 Nov 2019 15:06:47 +0100
header
C: MIME-Version: 1.0
C: Content-Type: text/plain; charset=utf-8;
C: blank line
C: Hola Isaias,
C: El 25 de diciembre toca el tema de Web Services, yo estoy liada ese díia,
C: por favor, ..podrias dar tu la clase?
C: Gracias y un saludo, body
C: Carmen Benavides
C: PD: No puedo poner tildes con este teclado
C: .
-----------------------------Connection Termination------------------------------------
S: 250 OK Message accepted for delivery
C: QUIT
S: 221 mail.smtp2go.com closing connection
Mail message format
Mail message format
Common Message Header Fields
* Mandatory Field name, a colon, a value
*
Mail message format
Electronic mail has a simple structure (RFC 822), 1982
But it can send messages only in 7-bit ASCII format.
Only for the English language
Can’t send binary files or video or audio data
MIME: Multipurpose Internet Mail Extensions
(RFC 1341), 1992
Additional lines in msg header declare MIME content type
Multiple objects in a single message
Binary and multimedia file attachments
Mail message format: MIME
Content-Type: type/subtype
Mail message format : MIME
Mail message format : MIME
From: pablete@unileon.es
To: mariano@mixmail.com
MIME-Version: 1.0
Content-Type: Multipart/Mixed; Boundary=afdsiuru83mrfAEF9EFAef
- -afdsiuru83mrfAEF9EFAef
Content-Type: text/plain
Hola Mariano,
Te mando las fotos.
Saludos.
Pablo
- -afdsiuru83mrfAEF9EFAef
Content-Type: image/jpg
Content-Transfer-Encoding: base64
..............datos de la imagen...............
Mail message format: MIME
Content-Transfer-Encoding:<type>
Base64
Base64 converting table
MIME-Version: 1.0
In-Reply-To: <67964256-2cc1-dc05-dccc-ba1cc6d6dec3@unileon.es>
Content-Type: multipart/mixed;
boundary="------------26223AC77B6BBC9B6FE019EF"
Content-Language: en-US
This is a multi-part message in MIME format.
--------------26223AC77B6BBC9B6FE019EF
Content-Type: image/jpeg;
name="foto.jpg"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="foto.jpg"
/9j/4AAQSkZJRgABAgAAAQABAAD/7QCEUGhvdG9zaG9wIDMuMAA4QklNBAQAAAAAAGc
cAigA
YkZCTUQwMTAwMGFhNjAzMDAwMDhhMDUwMDAwMmQwODAwMDA5NzA4MDAwMDEz
……
--------------26223AC77B6BBC9B6FE019EF
Content-Type: application/pdf;
name="O'Reilly - Postfix The Definitive Guide.pdf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="O'Reilly - Postfix The Definitive Guide.pdf"
JVBERi0xLjUNJeLjz9MNCjg5MTUgMCBvYmogPDwvTGluZWFyaXplZCAxL0wgMjcyMTQwO
C9P
IDg5MjAvRSA4MjgwOS9OIDM5N
Mail message format: MIME
Content-Transfer-Encoding:<type>
Quoted-printable
If the data consist mostly of ASCII characters with a small non-ASCII portion
If a character is ASCII, it is sent as is.
If a character is not ASCII, it is sent as three characters.
Mail message format: MIME
Bibliography
James F. Kurose and Keith W. Ross. Computer Networking: A Top-
Down Approach. Pearson. 2020
Fred Halsall. 2005. Computer Networking and the Internet (5th
Edition). Addison-Wesley Longman Publishing Co.
Ying-Dar Lin, Fred Baker, Ren-Hung Hwang, 2012, Computer Networks:
An Open Source Approach,McGraw-Hill Education
Behrouz Forouzan. 2010. TCP/IP Protocol Suite (4 ed.). McGraw-Hill
Request for Comments (RFC)www.ietf.org/rfc.html