1 / 30

Email

Email. SMTP - Simple Mail Transfer Protocol RFC 821 POP - Post Office Protocol RFC 1939 Also: RFC 822 Standard for the Format of ARPA Internet Text Messages RFCs 1521, 1522 Mime. Terminology. User Agent (UA) : end-user mail program

Anita
Download Presentation

Email

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Email • SMTP - Simple Mail Transfer Protocol • RFC 821 • POP - Post Office Protocol • RFC 1939 • Also: • RFC 822 Standard for the Format of ARPA Internet Text Messages • RFCs 1521, 1522 Mime Netprog: Email Protocols

  2. Terminology • User Agent (UA): end-user mail program • Message Transfer Agent (MTA): responsible for communicating with remote hosts and transmitting/receiving email (both a client and server). • Mail Exchanger: host that takes care of email for a domain. Netprog: Email Protocols

  3. SMTP Used to exchange mail messages between mail servers (Message Transfer Agents). MTA MTA MTA SMTP SMTP File System SMTP UA UA Netprog: Email Protocols

  4. SMTP Protocol • SMTP sender is the client • SMTP receiver is the server. • The communication use NVT ASCII. • Alternating dialogue: • client sends command and server responds with command status message. • Order of the commands is important! • Status messages include ascii encoded numeric status code (like 250, 220) and text string. Netprog: Email Protocols

  5. SMTP Commands • HELO- identifies sender • MAIL FROM: - starts a mail transaction and identifies the mail originator • RCPT TO: - identifies individual recipient. There may be multiple RCPT TO: commands. • DATA - sender ready to transmit a series of lines of text, each ends with \r\n. A line containing only a period ‘.’ indicates the end of the data. Netprog: Email Protocols

  6. Data Format • ASCII only- must convert binary to an ASCII representation to send via email. • What if we want to send a line containing only a period? • Sender prepends a period to any line staring with a period (in the message). • Receiver strips the leading period in any line that starts with a period and has more stuff. Netprog: Email Protocols

  7. Leading Period DATA 354 Start mail input; end with <CRLF>.<CRLF> this message is a test of SMTP .. ..foo .. . 250 2.6.0 <c2b1c1a0-3951-4fd6-b6fb-675c0ee4a0dd> Queued mail for delivery Resulting Message: this message is a test of SMTP . .foo . Netprog: Email Protocols

  8. Typical Exchange wyxu@canopus % telnet hub0.engr.sc.edu 25 Trying 129.252.21.22... Connected to hub0.engr.sc.edu. Escape character is '^]'. 220 HUB0.engr.sc.edu Microsoft ESMTP MAIL Service ready at Sat, 17 Nov 2007 20:18:49 -0500 HELO 250 HUB0.engr.sc.edu Hello [129.252.130.106] MAIL from:<wyxu@engr.sc.edu> 250 2.1.0 Sender OK RCPT to:<wyxu@cse.sc.edu> 250 2.1.5 Recipient OK DATA 354 Start mail input; end with <CRLF>.<CRLF> Subject:test from:sender@bla.com to:receiver@bla.com this is a test mail . 250 2.6.0 <c2b1c1a0-3951-4fd6-b6fb-675c0ee4a0dd> Queued mail for delivery Netprog: Email Protocols

  9. Other SMTP Commands VRFY - confirm that a name is a valid recipient. S: VRFY Smith R: 250 Fred Smith <Smith@USC-ISIF.ARPA> EXPN - expand an alias (group email address). S: EXPN Example-People R: 250-Jon Postel <Postel@USC-ISIF.ARPA> R: 250-Fred Fonebone <Fonebone@USC-ISIQ.ARPA> R: 250-Sam Q. Smith <SQSmith@USC-ISIQ.ARPA> R: 250-Quincy Smith <@USC-ISIF.ARPA:Q-Smith@ISI-VAXA.ARPA> R: 250-<joe@foo-unix.ARPA> R: 250 <xyz@bar-unix.ARPA> TURN - switch roles (sender <=> receiver). Netprog: Email Protocols

  10. more Commands SOML - Send Or Mail if recipient is logged in, display message on terminal, otherwise email. SAML - Send and Mail NOOP - send back a positive reply code. RSET - abort current transaction. Netprog: Email Protocols

  11. Envelopes, Headers, and Body • Envelopes are used by MTAs for delivery • Specified by MAIL and RCPT commands • MAIL from:<wyxu@engr.sc.edu> • RCPT to:<wyxu@cse.sc.edu> • Headers are used by user agents • RFC 822 specifies header format • Each header field contains a name, a colon, and field value • Body is content of message from sending user to receiving user • When transferred using DATA command, headers are sent first, followed by a blank line, followed by body Netprog: Email Protocols

  12. Mail Headers • Email messages contain many headers, some headers are created by the UA, some are automatically added by the MTA. • Every MTA adds (at least) a “Received:” header. • Some of the headers are read by (parsed) intermediate MTAs, but the content is ignored and passed on transparently. Netprog: Email Protocols

  13. Transmission of a Mail • User agent takes body, adds some headers, and passes to MTA • MTA adds some headers, adds envelope, and sends to another MTA Netprog: Email Protocols

  14. Transmission of a mail to foo@cs.vu.nl • MTA asks the DNS for CNAME records for cs.vn.nl and the response says non exist. • MTA asks the DNS for MX records for cs.vn.nl and get one record zephyr.cs.vn.nl Portion of a possible DNS database zephyr.cs.vu.nl. 86400 IN A 130.37.16.112 top.cs.vu.nl.86400 IN A 130.37.16.6 Netprog: Email Protocols

  15. Transmission of a mail to foo@cs.vu.nl • MTA asks the DNS for an A record for zephyr.cs.vn.nl and get back the value of 130.37.16.112. • An SMTP connection is initiated to 130.37.16.112 and the mail is sent. Portion of a possible DNS database zephyr.cs.vu.nl. 86400 IN A 130.37.16.112 top.cs.vu.nl.86400 IN A 130.37.16.6 Netprog: Email Protocols

  16. Improvements on SMTP • Envelope changes: Extended SMTP • Header changes: Non-ASCII characters • Body changes: Multipurpose Internet Mail Extensions (MIME) Netprog: Email Protocols

  17. Extended SMTP • Framework for adding extensions to SMTP • Client wishing to use new features can use EHLO, instead of HELO, to initiate session • Server lists extended commands in the 250 reply to EHLO command Netprog: Email Protocols

  18. Non-ASCII Characters • Allow additional characters in sender and receiver names and in subject • Header can contain encoded words =?charset ? encoding ? encoded-text ?= • Charset can be us-ascii or iso-8859-1 • Encoding can be quoted-printable (Q) or base-64 (B) • Using base-64, three consecutive bytes are encoded as four 6-bit values From: =?US-ASCII?Q?Keith_Moore?= <moore@cs.utk.edu> To:=?ISO-8859-1?Q?Keld_j=F8rn_Sim?= <test@gmail.com> Subject:=?ISO-8859-1?B?SWYgeW91IGNhbiByZWFkIHRoaXMgeW8=?==?ISO-8859-2?B?dSB1bmR1cnN0YW5kIHRoZSBleGFtcGxlLg==?= Netprog: Email Protocols

  19. Multipurpose Internet Mail Extensions • Problems: • Messages in languages with accents ( French and German) • non-Latin alphabets (Russian and Hebrew) • languages without alphabets (Chinese and Jamanese) • not containing text at all (audio or images) • Need to add structure and define encoding rules for non-ASCII messages. Netprog: Email Protocols

  20. Multipurpose Internet Mail Extensions • Allow structures in body • Five new header fields Mime-Version: Content-Type:(Type and format of the content) Content-Transfer-Encoding:(How body is wrapped for transmission) Content-ID: Content-Description:(Human-readable string telling what is in the message) • Seven content types: text, multipart, message, application, image, audio, video Mime-Version:1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII TEXT/ENRICHED, IMAGE/JPEG, VIDEO/MPEG, MESSAGE/EXTERNAL-BODY, MULTIPART/ALTERNATIVE… (more examples in the book) • Five encoding formats: 7bit, quoted-printable, base64, 8bit, binary Netprog: Email Protocols

  21. Multipart/mixed From: Nathaniel Borenstein <nsb@bellcore.com> To: Ned Freed <ned@innosoft.com> Subject: Sample message MIME-Version: 1.0 Content-type: multipart/mixed; boundary="simple boundary" This is the preamble. It is to be ignored, though it is a handy place for mail composers to include an explanatory note to non-MIME compliant readers. --simple boundary This is implicitly typed plain ASCII text. It does NOT end with a linebreak. --simple boundary Content-type: text/plain; charset=us-ascii This is explicitly typed plain ASCII text. It DOES end with a linebreak. --simple boundary-- This is the epilogue. It is also to be ignored. Netprog: Email Protocols

  22. Multipart/alternative From: Nathaniel Borenstein <nsb@bellcore.com> To: Ned Freed <ned@innosoft.com> Subject: Formatted text mail MIME-Version: 1.0 Content-Type: multipart/alternative; boundary=boundary42 --boundary42 Content-Type: text/plain; charset=us-ascii ...plain text version of message goes here.... --boundary42 Content-Type: text/richtext .... <bold>richtext</bold> version of same message goes here ... --boundary42 Content-Type: text/x-whatever .... fanciest formatted version of same message goes here ... --boundary42 -- Netprog: Email Protocols

  23. POP – Post Office Protocol • Used to transfer mail from a mail server to a UA. Mail Server POP UA File System Netprog: Email Protocols

  24. POP (version 3) • Similar to SMTP command/reply lockstep protocol. • Used to retrieve mail for a single user • requires authentication • Commands and replies are ASCII lines. • Replies start with “+OK” or “-ERR”. • Replies may contain multiple lines. Netprog: Email Protocols

  25. POP-3 Commands • USER - specify username • PASS - specify password • STAT - get mailbox status • number of messages in the mailbox. • LIST - get a list of messages and sizes. • One per line, termination line contains ‘.’ only. • RETR - retrieve a message Netprog: Email Protocols

  26. More POP-3 Commands • DELE - mark a message for deletion from the mailbox. • NOOP - send back positive reply • RSET - reset. All deletion marks are unmarked. • QUIT - remove marked messages and close the (TCP) connection. Netprog: Email Protocols

  27. Optional Commands • TOP - send header lines from messages. • APOP - alternative authentication • APOP name digest • a string identifying a mailbox and a MD5 digest string • `digest‘: is calculated by applying the MD5 algorithm to a string consisting of the timestamp (sent from POP server) followed by a shared secret. • Requires shared secret! • No clear text password on the network. • Does not authenticate the server!!!! Netprog: Email Protocols

  28. A Pop3 Exchange > telnet hub0.engr.sc.edu 110 Trying 129.252.21.22... Connected to hub0.engr.sc.edu. Escape character is '^]'. +OK Microsoft Exchange Server 2007 POP3 service ready … quit +OK Microsoft Exchange Server 2007 POP3 server signing off. Netprog: Email Protocols

  29. A Pop3 Exchange S: <wait for connection on TCP port 110> C: <open connection> S: +OK POP3 server ready <1896.697170952@dbc.mtview.ca.us> C: USER mrose S: +OK User accepted C: PASS mrosepass S: +OK Pass accepted C: STAT S: +OK 2 320 C: LIST S: +OK 2 messages (320 octets) S: 1 120 S: 2 200 S: . C: RETR 1 S: +OK 120 octets S: <the POP3 server sends message 1> S: . C: DELE 1 S: +OK message 1 deleted C: RETR 2 S: +OK 200 octets S: <the POP3 server sends message 2> S: . C: DELE 2 S: +OK message 2 deleted C: QUIT S: +OK dewey POP3 server signing off (maildrop empty) Netprog: Email Protocols

  30. APOP S: +OK POP3 server ready 1896.697170952@dbc.mtview.ca.us C: APOP mrose c4c9334bac560ecc979e58001b3e22fb S: +OK maildrop has 1 message (369 octets) C: LIST S: +OK 1 messages (320 octets) S: 1 320 S: . C: RETR 1 S: +OK 320 octets S: <the POP3 server sends message 1> S: . C: DELE 1 S: +OK message 1 deleted C: QUIT Netprog: Email Protocols

More Related