LIST
return list of file
in current directory
RETR filename
retrieves (gets) file
STOR filename
stores (puts) file onto
remote host
sample return codes
status code and
phrase (as in HTTP)
331 Username OK,
password required
125 data
connection already
open; transfer
starting
425 Can’t open
data connection
452 Error writing
file

Application Layer 2-48
Chapter 2: outline
2.1 principles of
network
applications
app architectures
app requirements
2.2 Web and HTTP
2.3 FTP
2.4 electronic mail
SMTP, POP3,
IMAP
2.5 DNS
2.6 P2P applications
2.7 socket
programming
with UDP and TCP

Application Layer 2-49
Electronic mail
Three major components:
user agents
mail servers
simple mail transfer
protocol: SMTP
User Agent
a.k.a. “mail reader”
composing, editing,
reading mail messages
e.g., Outlook, Thunderbird,
iPhone mail client
outgoing, incoming
messages stored on server
user mailbox
outgoing
message queue
mail
server
mail
server
mail
server
SMTP
SMTP
SMTP
user
agent
user
agent
user
agent
user
agent
user
agent
user
agent

Application Layer 2-50
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
mail
server
mail
server
mail
server
SMTP
SMTP
SMTP
user
agent
user
agent
user
agent
user
agent
user
agent
user
agent

Application Layer 2-51
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 (like
HTTP, FTP
)
commands:
ASCII text
response:
status code and phrase
messages must be in 7-bit ASCI

Application Layer 2-52
user
agent
Scenario: Alice sends message
to Bob
1) Alice uses UA to
compose message “to”
[email protected]
2) Alice’s UA sends
message to her mail
server; message placed
in message queue
3) client side of SMTP
opens TCP connection
with Bob’s mail server
4) SMTP client sends
Alice’s message over
the TCP connection
5) Bob’s mail server
places the message in
Bob’s mailbox
6) Bob invokes his user
agent to read message
mail
server
mail
server
1
2
3
4
5
6
Alice’s mail server
Bob’s mail server
user
agent

Application Layer 2-53
Sample SMTP interaction
S: 220 hamburger.edu
C: HELO crepes.fr
S: 250
Hello crepes.fr, pleased to meet you
C: MAIL FROM: <[email protected]>
S: 250 [email protected] Sender ok
C: RCPT TO: <[email protected]>
S: 250 [email protected] ... Recipient ok
C: DATA
S: 354 Enter mail, end with "." on a line by itself
C: Do you like ketchup?
C: How about pickles?
C: .
S: 250 Message accepted for delivery
C: QUIT
S: 221 hamburger.edu closing connection

Application Layer 2-54
Try SMTP interaction for yourself:
telnet servername 25
see 220 reply from server
enter HELO, MAIL FROM, RCPT TO, DATA, QUIT
commands
above lets you send email without using email
client (reader)

Application Layer 2-55
SMTP: final words
SMTP uses persistent
connections


You've reached the end of your free preview.
Want to read all 105 pages?
- Fall '08
- Ghoshal
- Domain Name System