Sie sind auf Seite 1von 15

SMTP, POP3, IMAP

File Transfer Access Method (FTAM), also known as File Transfer Access and Management or
Electronic File Transfer Access Method (EFTAM), is anISOstandard (8571) that specifies methods
of transferingfiles between networked computers. FTAM is based on the Open Systems
Interconnection (OSI) model and is similar to File Transfer Protocol (FTP) and Network File System
(NFS).
FTAM can be broken down into functional categories known as service classes, as follows:
Transfer class, which facilitates the simple exchange of files.
Management class, which facilitates the creation, modification and deletion of files.
Transfer-and-management class, which facilitates directory navigation and manipulation.
Access class, which facilitates operations on file access structures.

Chapter 2: Application
layer
2.1 Principles of

2.6 P2P applications

network applications
2.2 Web and HTTP
2.3 FTP
2.4 Electronic Mail

2.7 Socket

SMTP, POP3, IMAP

programming with TCP


2.8 Socket
programming with
UDP

2.5 DNS

2: Application2 Layer

Electronic Mail

outgoing
message queue
user mailbox

user
agent

Three major components:

user agents

mail
server

mail servers
simple mail transfer protocol:

user
agent
SMTP
mail
server

SMTP
SMTP

User Agent
a.k.a. mail reader

SMTP

composing, editing, reading mail

messages

user
agent

Mozilla Thunderbird
outgoing, incoming messages

user
agent

mail
server

e.g., Eudora, Outlook, elm,

stored on server

user
agent

user
agent

2: Application3 Layer

Electronic Mail: mail servers


Mail Servers
mailbox contains incoming
messages for user
message queue of outgoing
(to be sent) mail messages
SMTP protocol between mail
servers to send email
messages
client: sending mail server
server: receiving mail
server

user
agent
mail
server

user
agent
SMTP
mail
server

SMTP
SMTP

user
agent

mail
server
user
agent
user
agent

2: Application4 Layer

user
agent

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

handshaking (greeting)

transfer of messages

closure

command/response interaction

commands: ASCII text

response: status code and phrase

messages must be in 7-bit ASCII

2: Application5 Layer

Scenario: Alice sends message to


Bob

1) Alice uses UA to compose


message and to
bob@someschool.edu

2) Alices UA sends message


to her mail server; message
placed in message queue

3) Client side of SMTP


opens TCP connection with
Bobs mail server

1
user
agent

mail
server

mail
server
2

4) SMTP client sends Alices


message over the TCP
connection
5) Bobs mail server places
the message in Bobs
mailbox
6) Bob invokes his user
agent to read message

2: Application6 Layer

user
agent

Sample SMTP interaction


S:
C:
S:
C:
S:
C:
S:
C:
S:
C:
C:
C:
S:
C:
S:

220 hamburger.edu
HELO crepes.fr
250 Hello crepes.fr, pleased to meet you
MAIL FROM: <alice@crepes.fr>
250 alice@crepes.fr... Sender ok
RCPT TO: <bob@hamburger.edu>
250 bob@hamburger.edu ... Recipient ok
DATA
354 Enter mail, end with "." on a line by itself
Do you like ketchup?
How about pickles?
.
250 Message accepted for delivery
QUIT
221 hamburger.edu closing connection

2: Application Layer

Mail message format

SMTP: protocol for exchanging


email msgs
RFC 822: standard for text
message format:
header lines, e.g.,
To:
From:
Subject:
different from SMTP commands!
body
the message, ASCII
characters only

header

body

blank
line

Message format: multimedia extensions


MIME: multimedia mail extension, RFC 2045, 2056
additional lines in msg header declare MIME content

type
Types: Uuencode, base64, Quoted-printable
MIME version
method used
to encode data
multimedia data
type, subtype,
parameter declaration

From: alice@crepes.fr
To: bob@hamburger.edu
Subject: Picture of yummy crepe.
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Type: image/jpeg
base64 encoded data .....
.........................
......base64 encoded data

encoded data
2: Application9 Layer

MIME

10

Mail access protocols


SMTP

SMTP

user
agent
senders mail
server

receivers mail
server

SMTP: delivery/storage to receivers server

Mail access protocol: retrieval from server

access
protocol

POP: Post Office Protocol [RFC 1939]


authorization (agent <-->server) and download

IMAP: Internet Mail Access Protocol [RFC 1730]


more features (more complex)
manipulation of stored msgs on server

HTTP: gmail, Hotmail, Yahoo! Mail, etc.

user
agent

POP3 and SMTP

12

POP3 protocol
S: +OK POP3
authorization phase
client commands:

user: declare username


pass: password
server responses
+OK
-ERR

transaction phase, client:


list: list message

numbers
retr: retrieve message by
number
dele: delete
quit

server ready

C:
S:
C:
S:

user bob
+OK
pass hungry
+OK user successfully

C:
S:
S:
S:
C:
S:
S:
C:
C:
S:
S:
C:
C:
S:

list
1 498
2 912
.
retr 1
<message 1 contents>
.
dele 1
retr 2
<message 1 contents>
.
dele 2
quit
+OK POP3 server signing off

2: Application13Layer

logged on

POP3 (more) and IMAP


More about POP3

IMAP

Previous example uses

Keep all messages in one

download and delete


mode.
Bob cannot re-read e-mail if

he changes client
Download-and-keep:

copies of messages on
different clients
POP3 is stateless across

sessions

place: the server


Allows user to organize

messages in folders
IMAP keeps user state

across sessions:
names of folders and
mappings between
message IDs and folder
name

2: Application14Layer

SMTP, FTP and HTTP


Connections:
All use TCP
SMTP uses persistent
connections
FTP persistent control
channel, non-persistent data
channel per file.
HTTP uses both persistent
and non-persistent channels

Data Flow
FTP and HTTP: pull (user
requests files)
SMTP: push (email sent to
receiver without request,
result can be spam!)

15

All have ASCII


command/response
interaction, status codes
HTTP: each object
encapsulated in its own
response msg
FTP: one data channel per
file
SMTP: multiple objects sent
in multipart msg

Das könnte Ihnen auch gefallen