Professional Documents
Culture Documents
Lec 2 - Application Layer - IV - Electronic Mail
Lec 2 - Application Layer - IV - Electronic Mail
Lec 2 - Application Layer - IV - Electronic Mail
Communication Networks
EE-357
By Dr Mir Yasir Umair
Associate Professor, MCS, NUST
Application Layer
Lecture 02
Electronic Mail
E-Mail
Application Layer
Electronic mail
• E-mail is an asynchronous communication medium - people send
and read messages when it is convenient for them, without having
to coordinate with other people’s schedules.
• Accessing mail
o Webmail – web interface e.g. Google, Hotmail etc
o Email Client – program installed on user’s
PC e.g. Outlook
Electronic mail outgoing
message queue
user mailbox
Three major user
components: agent
Application Layer
Electronic Mail: SMTP [RFC 2821]
• uses TCP to reliably transfer email message
from client to server, port 25
• direct transfer: sending server to receiving
server
• three phases of transfer
o handshaking (greeting)
o transfer of messages
o closure
• command/response interaction (like HTTP,
FTP)
o commands: ASCII text
o response: status code and phrase
• messages must be in 7-bit ASCI
Application Layer
Scenario: Alice sends message to Bob
1) Alice uses UA to compose 4) SMTP client sends
message “to” Alice’s message over
bob@someschool.edu
the TCP connection
2) Alice’s UA sends
message to her mail 5) Bob’s mail server
server; message placed in places the message in
message queue Bob’s mailbox
3) client side of SMTP opens 6) Bob invokes his user
TCP connection with
Bob’s mail server agent to read message
Application Layer
SMTP VS HTTP
Comparators HTTP SMTP
Connection Persistent/ Non- Persistent
Persistent
Port # 80 25
Mail access protocols
user
mail access user
SMTP SMTP protocol
agent agent
(e.g., POP,
IMAP)
Application Layer
In a Nutshell
Application Layer
POP3
• In this protocol the folder structure is not in sync with other devices.
• It downloads emails only from the Inbox folder.
• It is good only if you want to retrieve an email from only one device.
• One of the advantage of POP3 protocol is that you can view your email even when
there is no internet connection.
• It helps in saving the storage space on the mail server.
Application Layer
POP 3
Disadvantage of using POP3:
• A backup plan is needed for your emails in case your device crashes or if its lost.
• Your device is unsafe to viruses as the emails are fully downloaded.
Application Layer
POP3 protocol
S: +OK POP3 server ready
C: user bob
authorization phase S: +OK
C: pass hungry
• client commands: S: +OK user successfully logged on
o user: declare username
o pass: password C: list
S: 1 498
• server responses
S: 2 912
o +OK S: .
o -ERR C: retr 1
transaction phase, S: <message 1 contents>
S: .
client:
C: dele 1
• list: list message numbers C: retr 2
• retr: retrieve message by S: <message 1 contents>
number S: .
• dele: delete C: dele 2
• quit C: quit
S: +OK POP3 server signing off
Application Layer
IMAP
• It is good for retrieving your email from multiple devices.
• All the emails are stored on the mail server so that you can retrieve them from any of
your devices.
• Also as the devices are synchronized you can view the emails in sent items, drafts,
deleted items and also emails in any custom folder.
Application Layer