sssss.pdf

31
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 22-1 Chapter 22 Simple Mail Transfer Protocol (SMTP)

Transcript of sssss.pdf

  • McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    22-1

    Chapter 22

    Simple MailTransfer 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

    Filesystem

    UAs and MTAsUser agent (mail reader, prepares the message, creates the envelope, puts the message in the envelope)

    Mail transfer agent(transfers the commands, replies and mail across the Internet)

    Well-known TCP port 25Ephemeral

    port

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

    Commonly used UNIX MTA is sendmail

  • McGraw-Hill 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.

    Filesystem

    Filesystem

  • McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    22-5Mail gateway

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

    Protocol other than SMTP

    Filesystem

  • McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    22-6USER AGENT (UA)

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

    MH (Message Handler, Rand corporation)BerkeleyMailElmZmailMush

    Some user agents have an extra user interface (GUI):

    Microsoft Outlook Express Eudora

  • McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    22-7

    Format of an E-mail

    USER AGENT (cont.)

  • McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    22-8

    E-mail addressUSER AGENT (cont.)

    Name of the mail gateway in the DNS data baseMust define the local physical network, the

    host computer and the user mailbox

    [email protected]

    Host ID: sciences.sdsu.edu (130.191.226.112)User mailbox ID: marko

    Mail server (Mail Exchanger): cs.sdsu.edu (130.191.226.116)

  • McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    22-9Sender-site delay

    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

    22-10Receiver-site delay

    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-11AliasesSMTP 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-12One-to-many expansion

    alias group [email protected] [email protected] [email protected]

  • McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    22-13Many-to-one expansion

  • McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    22-14Complete Email System

    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

    22-15Commands and responses

  • McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    22-16

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

    DescriptionSMTP Commands

    Most of the implementations do not support thisTURNAsk the receiver to send an OKNOOP Ask receiv. to send the information about indicated commandHELP:

    Ask receiver to return the membership of the mailing listEXPN Verify the address of the recipientVRFY [email protected] Send and mail; to terminal (if logged on) and to mboxSAML FROM: [email protected]

    Send or mail; to terminal if logged on, otherwise to mboxSOML FROM: [email protected] to be delivered to recipient's terminal, not to mboxSEND FROM: [email protected] the current transaction, reset the connectionRSET

    The lines following DATA are the message, bufferedDATA text CRLF . CRLFIdentify a single recipient. Multiple RCPT can be sentRCPT TO: [email protected] Initiate the mail transactionMAIL FROM: [email protected] identifies itself, receiver sends back its domain n.HELO cs.sdsu.edu

    SMTP CommandsMandatory commands (every implementation must support these)

  • McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    22-17

    User not local, the message will be forwarded

    251

    Command aborted, insufficient storage

    452Request command completed250

    Command aborted, local error451Service closing transmission channel221

    Mailbox not available450Service ready 220

    Service not available421Help message214

    Start mail input354System status or help reply211

    Descrition)CodeDescritionCode

    Responses

    2xx Positive Completion Reply3xx Positive Intermediate Reply4xx Transient Negative Completion Reply

  • McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    22-18

    Transaction failed554Command temporarily not implemented

    504

    Requested action not taken: mailbox name not allowed

    553Bad sequence of commands503

    Requested action aborted: exceeded storage location

    552Command not implemented502

    User not local551Syntax error: bad parameters501

    Command not executed, mailbox not available

    550Syntax error: unrecognized command

    500

    Descrition)CodeDescritionCode

    Responses (cont.)

    5xx Permanent Negative Completion Reply

  • McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    22-19

    Mail transfer phases:

    Connection establishmentMessage transferConnection termination

  • McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    22-20

    Connection establishment

  • McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    22-21Message transfer

  • McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    22-22Message transfer (cont.)

    End of the text

  • McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    22-23

    Connection termination

  • McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    22-24Multipurpose Internet Mail Extensions (MIME)

    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

    (RFC 2047, Univ. of Tennessee, 1996)

  • McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    22-25

    MIME headerMIME 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

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

    General 8-bit data (8-bit bytes)Octet-Stream

    Adobe PostScriptPostScriptApplication

    Single channel voice encoding at 8 KHzBasicAudio

    Video is in MPEG formatMPEGVideo

    Image is in GIF formatGIF

    Image is in JPEG formatJPEGImage

    Unformatted textPlainText

    DescriptionSubtypeType

    Data Types and Subtypes in MIME

  • McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    22-27

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

    Non-ASCII characters with unlimited-length linesbinary

    Non-ASCII characters are encoded as an equal sign followed by an ASCII code

    Quoted-printable

    Non-ASCII characters and short lines8-bit

    NVT ASCII characters and short lines (less than 1000 characters)

    7-bit

    DescriptionType

    Content-Transfer-Encoding

    Very popular

  • McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    22-28Base64

    Has 1 at the beginning

    8*3 = 6*4

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

    Numbers between0 and 63

  • McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    22-29

    Base64 Encoding Table

  • McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    22-30Email delivery

    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

    The remote server receives mail from the local server, then stores it into users mailbox

    Remote server

    The remote UA uses a mail access protocol (POP3 or IMAP4) to access the mailbox

  • McGraw-Hill The McGraw-Hill Companies, Inc., 2000

    22-31Post Office Protocol (POP3)

    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)

    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