simple mail transfer protocol (smtp) kanika thapar cisc 856 tcp/ip and upper layer protocols...

Download Simple Mail Transfer Protocol (SMTP) Kanika Thapar CISC 856 TCP/IP and Upper Layer Protocols 11/8/2007 (Some slides provided by Ezra Kissel, some figures

If you can't read please download the document

Upload: amice-warner

Post on 23-Dec-2015

214 views

Category:

Documents


0 download

TRANSCRIPT

  • Slide 1
  • Simple Mail Transfer Protocol (SMTP) Kanika Thapar CISC 856 TCP/IP and Upper Layer Protocols 11/8/2007 (Some slides provided by Ezra Kissel, some figures taken from Forouzans book)
  • Slide 2
  • 2 IntroductionIntroduction SendmailSendmail How SMTP works?How SMTP works? SMTP data transferSMTP data transfer ExamplesExamples Limitations & extensionsLimitations & extensions Retrieving mail (Mailbox protocols)Retrieving mail (Mailbox protocols) Overview
  • Slide 3
  • 3 Introduction
  • Slide 4
  • 4 Composes, reads, replies to,forwards and handles mailboxes Transfers mails from one host to another Collects mail and delivers to user agent Transfers mails from one host to another Collects mail and delivers to user agent Introduction
  • Slide 5
  • 5 Message transfer SMTP is a push protocol
  • Slide 6
  • 6 Sendmail Mail Transfer Agent [MTA] : is a computer program or software agent that transfers electronic mail messages from one computer to another. Sendmail is a MTA Supports several mail transfers including SMTP Pros Can perform header rewriting, mail routing Extensive support available Cons Not secure Code is bulky [compared to other MTAs such as qmail]
  • Slide 7
  • 7 SMTP server can also assume the role of a relay SMTP mail gateways are used to transport mail prepared by a protocol other than SMTP Relays and Gateways SMTP supported Non-SMTP supported
  • Slide 8
  • 8 Link Layer PCI IP-PCI Keyword: argument(s) Command format: Response format: 3-digit status code [textual information] How SMTP works? Link Layer PCI IP-PCI TCP-PCI SMTP command/response TCP-PCI SMTP command/response TCP-PCI SMTP command/response
  • Slide 9
  • 9 SMTP A-PDUs The Basics KeywordArguments HELOSenders host domain name MAIL FROM:Email address of sender RCPT TO:Email of intended recipient DATABody of the message QUIT KeywordArguments RSET VRFYName to be verified NOOP TURN EXPNMailing list to expand HELPCommand name The Extras
  • Slide 10
  • 10 How SMTP works : Status Codes The Server responds with a 3 digit code that may be followed by text info 2## - Success 3## - Command can be accepted with more information 4## - Command was rejected, but error condition is temporary 5## - Command rejected, Bad User!
  • Slide 11
  • 11 Traditional mail vs email Traditional mail envelope and body E-mail envelope and body
  • Slide 12
  • 12 Connection Establishment Port 25Ephemeral portPort 25Ephemeral port SYN SYN+ACK SYN
  • Slide 13
  • 13 Ephemeral port Port 25
  • Slide 14
  • 14 Connection Termination Port 25Ephemeral port RESET FIN ACK
  • Slide 15
  • 15 Simulating MTA client using telnet % telnet mail.adelphia.net 25 Trying 68.168.78.100... Connected to mail.adelphia.net (68.168.78.100). 220 mta13.adelphia.net SMTP server ready Thur, 8 Nov 2007.. HELO mail.adelphia.net 250 mta13.adelphia.net MAIL FROM: [email protected] 250 Sender Ok RCPT TO: [email protected]@udel.edu 250 Recipient Ok ================== ConnectionEstablishment================ =====================Envelope==========================
  • Slide 16
  • 16 DATA 354 Ok Send data ending with. From: Forouzan TO: Thapar This is a test message to show SMTP in action.. 250 Message received: [email protected] Simulating MTA client using telnet QUIT 221 mta13.adelphia.net SMTP server closing connection Connection closed by foreign host. =================== Header and Body =================== ============= Connection Termination====================
  • Slide 17
  • 17 Limitations in SMTP Only uses NVT 7 bit ASCII format How to represent other data types? Susceptible to misuse (Spamming, faking sender address)
  • Slide 18
  • 18 Solution: SMTP extensions MIME Multipurpose Internet Mail Extensions Transforms non-ASCII data to NVT (Network Virtual Terminal) ASCII data
  • Slide 19
  • 19 MIME headers
  • Slide 20
  • 20 MIME headers (contd) Content-Type Type of data used in the Body Text: plain, unformatted text; HTML Multipart: Body contains different data types Message: Body contains a whole, part, or pointer to a message Image: Message contains a static image (JPEG, GIF) Video: Message contains an animated image (MPEG) Audio: Message contains a basic sound sample (8kHz) Application: Message is of data type not previously defined Content-Transfer-Encoding How to encode the message 7 bit no encoding needed 8 bit Non-ASCII, short lines Binary Non-ASCII, unlimited length lines Base64 6 bit blocks encoded into 8-bit ASCII Quoted-printable send non-ASCII characters as 3 ASCII characters
  • Slide 21
  • 21 Base64 Encoding Divides binary data into 24 bit blocks Each block is then divided into 6 bit chunks Each 6-bit section is interpreted as one character 11001100 10000001 00111001 01111010010010010100010100110101 (51)(8)(4)(57) (z)(I)(E)(5)
  • Slide 22
  • 22 Base64 Encoding table
  • Slide 23
  • 23 From: Kanika Thapar To: [email protected] Subject: attachment test MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; boundary="MIMEStream=_0+92061_793033260215529_597673089" --MIMEStream=_0+92061_793033260215529_597673089 Content-Type: TEXT/PLAIN; charset="US-ASCII"; format=flowed There is an image attached... --MIMEStream=_0+92061_793033260215529_597673089 Content-Type: IMAGE/jpeg; name="test.jpg" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="test.jpg" /9j/4AAQSkZJRgABAgEASABIAAD/4QNxRXhpZgAATU0AKgAAAAgABwESAAMA AAABAAEAAAEaAAUAAAABAAAAYgEbAAUAAAABAAAAagEoAAMAAAABAAIAAAEx osv/0I5nPvr7sVdirsVf/9GO5z76+6hxQ1il2Kv/0o5nPvr7eKtYq7FX/9k= --MIMEStream=_0+92061_793033260215529_597673089-- Multipart, Encoded MIME Message
  • Slide 24
  • 24 Mail Access Protocols POP3 & IMAP4 SMTP POP3 IMAP4
  • Slide 25
  • 25 POP3
  • Slide 26
  • 26 Post Office Protocol v3 Allows the user to obtain a list of their Emails Users can retrieve their emails Users can either delete or keep the email on their system Minimizes server resources
  • Slide 27
  • 27 Internet Mail Access Protocol v4 User can check the email header before downloading Can search the email for a specific string of characters before downloading User can download parts of an email User can create, delete, or rename mailboxes on a server
  • Slide 28
  • 28 Quoted-Printable Encoding Used when the data has a small non-ASCII portion Non-ASCII characters are sent as 3 characters First is =, second and third are the hex representation of the byte =##, ## is the hex representation of the byte 01001100 10011101 00111001 001111010011100101000100 (=)(9)(9)(D)(D)
  • Slide 29
  • 29 ASCII table