ftpsmtp-110624170942-phpapp01

download ftpsmtp-110624170942-phpapp01

of 11

Transcript of ftpsmtp-110624170942-phpapp01

  • 7/28/2019 ftpsmtp-110624170942-phpapp01

    1/11

    1

    Notes derived from ComputerNetworking: A Top Down ApproachFeaturing the Internet

    , 2005, 3

    rd

    edition,Jim Kurose, Keith Ross, Addison-Wesley.

    Application Layer: FTP & Email

  • 7/28/2019 ftpsmtp-110624170942-phpapp01

    2/11

    2

    File Transfer Protocol (FTP)

    FTP client contacts FTPserver at port 21, specifyingTCP as transport protocol

    Client obtains authorization

    over control connection Client browses remote

    directory by sendingcommands over controlconnection.

    When server receives acommand for a file transfer,the server opens a new TCPdata connection to client

    After transferring one file,

    server closes connection.

    FTP

    client

    FTP

    server

    TCP control connectionport 21

    TCP data connectionport 20

    Server opens a seperate TCPdata connection to transferanother file.

    Therefore, controlconnection is out of band.

    FTP server maintains state:current directory, earlierauthentication

  • 7/28/2019 ftpsmtp-110624170942-phpapp01

    3/11

    3

    FTP commands, responses

    Sample commands: sent as 7-bit ASCII text

    over control channel

    USERusername

    PASS password

    LISTreturn list of files incurrent directory

    RETR filenameretrieves

    (gets) file STOR filenamestores

    (puts) file onto remotehost

    Sample return codes(n) status code and phrase (as

    in HTTP)

    331 Username OK,

    password required 125 data connection

    already open;

    transfer starting

    425 Cant open data

    connection 452 Error writing

    file

  • 7/28/2019 ftpsmtp-110624170942-phpapp01

    4/11

    4

    Electronic Mail

    Three majorcomponents:

    user agents

    e.g., Eudora, Outlook,Pine

    mail servers Incoming, outgoing

    messages

    Simple Mail TransferProtocol: SMTP

    user mailbox

    outgoingmessage queue

    mailserver

    useragent

    useragent

    useragent

    mail

    server

    useragent

    useragent

    mailserver

    useragent

    SMTP

    SMTP

    SMTP

  • 7/28/2019 ftpsmtp-110624170942-phpapp01

    5/11

    5

    Electronic Mail: SMTP [RFC 2821](n)

    Clients SMTP mail server establishes a TCPconnection to the recipients SMTP server usingPort 25

    three phases in messg. 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

  • 7/28/2019 ftpsmtp-110624170942-phpapp01

    6/11

    6

    Sample SMTP interactionS: 220 hamburger.edu

    C: HELO crepes.fr

    S: 250 Hello crepes.fr, pleased to meet you

    C: MAIL FROM:

    S: 250 [email protected]... Sender ok

    C: RCPT TO:

    S: 250 [email protected] ... Recipient okC: DATA

    S: 354 Enter mail, end with "." on a line by itself

    C: First line in the mail

    C: Second line in the mail

    C: .

    S: 250 Message accepted for deliveryC: QUIT

    S: 221 hamburger.edu closing connection

  • 7/28/2019 ftpsmtp-110624170942-phpapp01

    7/11

    7

    Try SMTP interaction for yourself(n)

    telnet servername 25

    see 220 reply from server

    enter HELO, MAIL FROM, RCPT TO, DATA, QUIT

    commandsabove lets you send email without using email client

    (reader)

  • 7/28/2019 ftpsmtp-110624170942-phpapp01

    8/11

    8

    SMTP: final words

    SMTP uses persistentconnections: multiplemessages can be sent to thedestination with single TCPconnection

    SMTP requires message(header & body) to be in 7-bitASCII

    SMTP server uses CRLF.CRLFto determine end of message

    SMPT is a chatty protocol Header lines are part of the

    text message. It is not thepart of the commands

    Comparison with HTTP:

    HTTP: pull SMTP: push

    SMTP command/response7-bit ASCII. SMTPmessages must be ASCII.HTTP does not imposerestrictions for message.

    HTTP: each objectencapsulated in its ownresponse msg

    SMTP: multiple objectssent in multipart msg

  • 7/28/2019 ftpsmtp-110624170942-phpapp01

    9/11

    9

    Mail message format

    SMTP: protocol forexchanging email msgs

    RFC 822: standard for textmessage format:

    header lines, e.g., To:

    From:

    Subject:

    differentfrom SMTP

    commands! body

    the message, ASCIIcharacters only

    header

    body

    blankline

  • 7/28/2019 ftpsmtp-110624170942-phpapp01

    10/11

    10

    Message format: multimedia extensions

    MIME: Multipurpose Internet Mail Extensions additional lines in msg header declare MIME content

    type

    From: [email protected]

    To: [email protected]: Picture of yummy crepe.

    MIME-Version: 1.0

    Content-Transfer-Encoding: base64

    Content-Type: image/jpeg

    base64 encoded data .....

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

    ......base64 encoded data

    multimedia data

    type, subtype,parameter declaration

    method usedto encode data

    MIME version

    encoded data

  • 7/28/2019 ftpsmtp-110624170942-phpapp01

    11/11

    11

    Mail access protocols

    SMTP is a push protocol. How will a user access emails?

    Mail access protocol: retrieval from server

    POP: Post Office Protocol [RFC 1939]

    Users cant create folders on mail server

    IMAP: Internet Mail Access Protocol [RFC 1730] more features (more complex)

    manipulation of stored msgs on server

    HTTP: Hotmail , Yahoo! Mail, etc.

    useragent

    senders mailserver

    useragent

    SMTP SMTP accessprotocol

    receivers mailserver