Sie sind auf Seite 1von 31

22-1

Chapter 22

Simple Mail
Transfer Protocol
(SMTP)
McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

22-2

SMTP concept
(RFC 821, ISI, USC 1982)

Can send text, graphics, voice, video


McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

22-3

UAs and MTAs


User agent
(mail reader, prepares
the message, creates the
envelope, puts the
message in the envelope)

UA periodically checks
the milboxes and
informs the user by
giving a notice

Commonly used UNIX


MTA is sendmail

File
system

Mail transfer agent


(transfers the
commands, replies
and mail across the
Internet)

Ephemeral
port

McGraw-Hill

Well-known
TCP port 25

The McGraw-Hill Companies, Inc., 2000

22-4

Relay MTAs
The receivers server may be down and the
relaying MTA can store the mail and make
repeated attempts later to deliver mail to the
server for several days. If the recipient's
server is still unavailable, the mail will be
returned to the sender.

File
system

McGraw-Hill

File
system

The McGraw-Hill Companies, Inc., 2000

22-5

Mail gateway
Relaying system allows
connection between
parties who may or may
not have TCP/IP protocol
suite.

File
system

Protocol other
than SMTP
McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

USER AGENT (UA)

22-6

UA is defined by SMTP but the implementation is left to vendors.


Popular UA programs:
MH (Message Handler, Rand corporation)
BerkeleyMail
Elm
Zmail
Mush
Some user agents have an extra user interface (GUI):
Microsoft Outlook Express
Eudora
McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

USER AGENT (cont.)

22-7

Format of an E-mail

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

22-8

USER AGENT (cont.)


E-mail address

Must define the local


physical network, the
host computer and the
user mailbox

marko@cs.sdsu.edu

Name of the mail


gateway in the
DNS data base

Mail server (Mail Exchanger):


cs.sdsu.edu (130.191.226.116)

Host ID: sciences.sdsu.edu (130.191.226.112)


User mailbox ID: marko
McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Sender-site delay

22-9

SMTP allows delayed delivery

Messages stored before being sent. The mail


transfer system periodically (10 30 min)
checks if the mail can be sent (if the IP address
of the mail server has been obtained from the
DNS). After 3 5 days, the unsent mail is
returned to the sender.

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Receiver-site delay

22-10

Mail received by the SMTP server is


stored in mailbox. User can read the mail
at her/his convenience.

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

22-11

Aliases
SMTP allows that a single name
represent several different e-mil
addresses (one-to-many-alias
expansion)

SMTP also allows that


several e-mail addresses are
assigned to the same mailbox
(many-to-one-alias
expansion)

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

22-12

One-to-many expansion

alias group john@nett.com joe@deanza.edu janet@mcgraw.com

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Many-to-one expansion

McGraw-Hill

22-13

The McGraw-Hill Companies, Inc., 2000

Complete Email System

22-14

SMTP is a bidirectional
e-mail system, therefore both
ends must have an MTA
client and an MTA server.

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Commands and responses

McGraw-Hill

22-15

The McGraw-Hill Companies, Inc., 2000

SMTP Commands

22-16

Mandatory commands
(every implementation must support these)

SMTP Commands

Description

HELO cs.sdsu.edu

Client identifies itself, receiver sends back its domain n.

MAIL FROM: marko@cs.sdsu.edu

Initiate the mail transaction

RCPT TO: masc0860@rohan.sdsu.edu

Identify a single recipient. Multiple RCPT can be sent

DATA text CRLF . CRLF

The lines following DATA are the message, buffered

QUIT

Ask the receiver to send an OK and to close the connection

RSET

Abort the current transaction, reset the connection

SEND FROM: marko@cs.sdsu.edu

Message to be delivered to recipient's terminal, not to mbox

SOML FROM: marko@cs.sdsu.edu

Send or mail; to terminal if logged on, otherwise to mbox

SAML FROM: marko@cs.sdsu.edu

Send and mail; to terminal (if logged on) and to mbox

VRFY masc0860@rohan.sdsu.edu

Verify the address of the recipient

EXPN <mailing list (alias)>

Ask receiver to return the membership of the mailing list

HELP: <command>

Ask receiv. to send the information about indicated command

NOOP

Ask the receiver to send an OK

TURN

Most of the implementations do not support this

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

22-17

Responses
Code

Descrition

Code

Descrition)

211

System status or help reply

354

Start mail input

214

Help message

421

Service not available

220

Service ready

450

Mailbox not available

221

Service closing transmission channel

451

Command aborted, local error

250

Request command completed

452

Command aborted, insufficient


storage

251

User not local, the message will be


forwarded

2xx Positive Completion Reply


3xx Positive Intermediate Reply
4xx Transient Negative Completion Reply
McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

22-18

Responses (cont.)
Code

Descrition

Code

Descrition)

500

Syntax error: unrecognized


command

550

Command not executed, mailbox not


available

501

Syntax error: bad parameters

551

User not local

502

Command not implemented

552

Requested action aborted: exceeded


storage location

503

Bad sequence of commands

553

Requested action not taken: mailbox


name not allowed

504

Command temporarily not


implemented

554

Transaction failed

5xx Permanent Negative Completion Reply

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

22-19

Mail transfer phases:


Connection establishment
Message transfer
Connection termination

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

22-20

Connection establishment

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Message transfer

McGraw-Hill

22-21

The McGraw-Hill Companies, Inc., 2000

Message transfer (cont.)

22-22

End of the text


McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

22-23

Connection termination

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Multipurpose Internet Mail Extensions (MIME)

22-24

(RFC 2047, Univ. of Tennessee, 1996)


SMTP can send messages only in NVT 7-bit ASCII format
(problem with foreign languages that are not supported
by 7-bit ASCII. Cant send binary files and audio/video.)
Therefore the MIME is added on top of SMTP to allow
for non-ASCII data to be sent through SMTP.

MIME transforms data between


non-ASCII and NVT ASCII

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

22-25

MIME header
MIME is a set of software functions that transform non-ASCII data to NVT
ASCII data and vice versa. Therefore the transformation parameters have to be
defined. This is done through an additional header.

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

22-26

Data Types and Subtypes in MIME


Type

Description

Text

Plain

Unformatted text

Image

JPEG

Image is in JPEG format

GIF

Image is in GIF format

MPEG

Video is in MPEG format

Video

McGraw-Hill

Subtype

.......... ...........

..............................

Audio

Basic

Single channel voice encoding at 8 KHz

Application

PostScript

Adobe PostScript

Octet-Stream

General 8-bit data (8-bit bytes)

The McGraw-Hill Companies, Inc., 2000

22-27

Content-Transfer-Encoding
Type

Very
popular

McGraw-Hill

Description

7-bit

NVT ASCII characters and short lines (less than 1000


characters)

8-bit

Non-ASCII characters and short lines

binary

Non-ASCII characters with unlimited-length lines

Base64

6-bit blocks are encoded into 8-bit ASCII characters

Quotedprintable

Non-ASCII characters are encoded as an equal sign


followed by an ASCII code

The McGraw-Hill Companies, Inc., 2000

22-28

Base64
Has 1 at the
beginning

8*3 = 6*4

Binary values
are converted
into printable
ASCII characters
(see next slide)

McGraw-Hill

Numbers
between
0 and 63

The McGraw-Hill Companies, Inc., 2000

22-29

Base64 Encoding Table

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

22-30

Email delivery

Remote server
The remote server receives
mail from the local server,
then stores it into users
mailbox
The client send the mail to the local
server (the remote server may not be
available, therefore the mail is stored in
local server until it can be sent). Local
server acts then as a client and sends the
mail to the remote server
McGraw-Hill

The remote UA uses a


mail access protocol
(POP3 or IMAP4) to
access the mailbox

The McGraw-Hill Companies, Inc., 2000

Post Office Protocol (POP3)


SMTP is a push
protocol
(it pushes mail
from the sender
to the receivers
mail box.

Another mail access


protocol is IMAP4
(Internet Mail Access
Protocol).
Has more features

McGraw-Hill

22-31

POP3 is a mail
access protocol
(mail reader)
which is not
part of the
SMTP.
POP3 is a
pull protocol
(the receiving
user is pulling
the mail from
the mailbox)

The McGraw-Hill Companies, Inc., 2000

Das könnte Ihnen auch gefallen