email
play

Email SMTP - Simple Mail Transfer Protocol RFC 821 POP - Post - PowerPoint PPT Presentation

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 1


  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 1

  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 2

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

  4. SMTP Protocol • SMTP sender is the client • SMTP receiver is the server. • 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 4

  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 5

  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 6

  7. 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> this is a test mail . 250 2.6.0 <c2b1c1a0-3951-4fd6-b6fb-675c0ee4a0dd> Queued mail for delivery Netprog: Email Protocols 7

  8. 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 this message is a test of SMTP SMTP . . .foo .foo . . Netprog: Email Protocols 8

  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 9

  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 10

  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 11

  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 12

  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 13

  14. Relay Agents • All individual systems send their mail to a relay system • Two reasons of using relay system – Simplify configuration of all MTAs other than relay system’s MTA – Allow one system at an organization to act as mail hub • Most organizations use relay system for Internet mail Netprog: Email Protocols 14

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

  16. 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 16

  17. 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 =F8 rn_Sim? =<test@gmail.com> Subject:=?ISO-8859-1?B?SWYgeW91IGNhbiByZWFkIHRoaXMgeW8=?==?ISO- 8859-2?B?dSB1bmR1cnN0YW5kIHRoZSBleGFtcGxlLg==?= Netprog: Email Protocols 17

  18. Multipurpose Internet Mail Extensions • Allow structures in body • Five new header fields Mime-Version: Content-Type: Content-Transfer-Encoding: Content-ID: Content-Description: • Seven content types: text, multipart, message, application, image, audio, video Mime-Version:1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII • Five encoding formats: 7bit, quoted-printable, base64, 8bit, binary Netprog: Email Protocols 18

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

  20. 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 20

  21. 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 21

  22. 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 22

  23. Optional Commands • TOP - send header lines from messages. • APOP - alternative authentication – message digest based on opening greeting sent from POP server. – Requires shared secret! – No cleartext password on the network. – Does not authenticate the server!!!! Netprog: Email Protocols 23

  24. 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 24

  25. 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 25

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend