1 / 69

Chapter 26: SMTP and a Brief Introduction to POP, IMAP and MIME

Chapter 26: SMTP and a Brief Introduction to POP, IMAP and MIME Clemson Lugtu Jeff Hahn Jeremy Uziel What is Electronic Mail? Electronic Mail - It is a facility that allows users to transmit messages across the Internet. It is the most widely used application service offering

mike_john
Télécharger la présentation

Chapter 26: SMTP and a Brief Introduction to POP, IMAP and MIME

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. Chapter 26: SMTP and a Brief Introduction to POP, IMAP and MIME Clemson Lugtu Jeff Hahn Jeremy Uziel

  2. What is Electronic Mail? • Electronic Mail - It is a facility that allows users to transmit messages across the Internet. • It is the most widely used application service offering a fast conventional method of transferring information. • It can accommodate large messages or voluminous memos. • It allows communication between groups or single individuals.

  3. Spooling • Electronic mail systems use a technique known as SPOOLING to handle delayed delivery • When user sends a mail, the system places a copy in its private storage (also known as a spool) • The system initiates transfer to remote machine as a background activity. • The background mail transfer process becomes client. • If succeeded, the transfer process passes a copy of the message to the remote server.

  4. Spooling • If it fails, the transfer process records the time delivery was attempted and terminates. • The background transfer process sweeps through the spool area periodically. (usually 30 minutes) • A spool also contains the identification of the sender, recipient, destination machine, and the time a mail message was deposited. • When it finds a message or when a user deposits new outgoing mail, it attempts delivery. • If a mail message can't be delivered after an extended time, the mail software returns the mail message to the sender.

  5. Electronic Mail Addresses • A receiver is identified by an email address such as: • local-part @ domain-name • domain-name : Specifies a mail exchanger. It determines the domain name of a mail destination to which mail should be delivered. • local part : Specifies a mailbox on the mail exchanger. It is often identical to a login name or a full name of a user.

  6. Example electronic mail addresses • clem@csun.edu comer@purdue.edu john@example.com bill@college.edu clem, comer, and john distinguish the local part of an electronic mail address. csun.edu, purdue.edu, and example.com distinguish the domain-name part of an email address.

  7. Alias expansion and mail forwarding • Most systems provide (mail forwarding) software that includes a (mail alias expansion) mechanism. • A (mail forwarder) allows a local site to map identifiers used in mail addresses to a set of one or more new mail addresses. • After a user composes a message and names a recipient, the (mail interface program) talks to the local aliases to replace the recipient with the mapped version before passing the message to the delivery system. • Recipients to which no mapping was provided stays unchanged.

  8. TCP/IP Standards forElectronic Mail Service • TCP/IP provides interoperability for electronic mail. • TCP/IP divides its mail standards into two sets. One standard specifies the format for mail messages. The other standard specifies the details of electronic mail exchange between two computers • Each memo is divided into two parts: header and body separated by a blank line • header : must contain "From" and "To" fields. • body : The format of the body is left to the sender

  9. Post Office ProtocolVersion 3 (POP3) • Post Office Protocol Version 3 has been the most popular protocol has been the most popular protocol used to transfer messages from a permanent mailbox to a local computer. • When the user invokes a POP3 client, it establishes a TCP connection and contacts a POP3 server on the mailbox computer. The user sends a login and a password to authenticate the session. If login was successful, the client sends commands to retrieve copies of messages and to delete messages from the permanent mailbox. • Both SMTP servers and POP3 servers must synchronize access to the mailbox.

  10. POP3 Commands • USER name: User name for authentication • PASS password: Password used for authentication • STAT: Get number and total size of message • LIST: [msg] get size of message • RETR: msg Send message to client • DELE: msg Delete message from mailbox • RSET: Cancel previous delete requests. • QUIT: Updates mailbox (deletes messages) and quits.

  11. Internet Message AccessProtocol (IMAP) • An alternative to POP3 is IMAP version 4. It defines an abstraction known as a MAILBOX. Mailboxes are located on the same computer as a server. • IMAP4 is a method for accessing electronic mail messages that are kept on a mail server. It permits a client e-mail program to view and manipulate those messages. • Electronic mail stored on an IMAP server can be viewed or manipulated from a desktop computer at home, a notebook computer, or at a workstation. We can also say that mail messages can be accessed from multiple locations.

  12. What are the functionsof IMAP4? Includes operations for: • creating mailboxes • deleting mailboxes • renaming mailboxes • checking for new messages • permanently removing messages • setting and clearing flags • searching • fetching of message attributes texts, and portions.

  13. IMAP provides extended functionality for message retrieval and processing. • Users can obtain information about a message or examine header fields without retrieving the entire message. • Users can search for a specified string and retrieve portions of a message. This is useful for slow-speed dialup connections since they wont need to download useless information.

  14. Multipurpose Internet Mail Extensions (MIME) • MIME is defined to allow transmission of non-ASCII or arbitrary data through a standard e-mail message. • In other words, MIME has a mechanism for sending multimedia data over e-mail.

  15. MIME Messages • MIME information is contained in the mail header using standard RFC 2822 format. • MIME header specifies version, data type, encoding used to convert the data to ASCII.

  16. Header Lines ofMIME Messages • MIME-Version: shows how message was composed using the version 1.0 of the MIME protocol. • Content-Type: Specifies the 7 basic content types of data in the message: • Text (a simple text document) • image (photograph or computer generated image) • audio (sound recordings) • video (video recordings) • application (raw program data) • multipart (multiple messages with each having a seperate • content type and recording. • message (an entire e-mail message) • Content-Type must have 2 identifiers, a content-type and a subtype. type/subtype(i.e. image/jpeg, audio/wav, image/gif)

  17. Header Lines ofMIME Messages • Content-Transfer-Encoding: type of encoding that was used • (base64 for JPEG images) to convert the data to ASCII. Example: From: bill@college.edu To: john@example.com MIME-Version: 1.0 Content-Type: image/jpeg Content-Transfer-Encoding: base64 ..data for the image..

  18. MIME Multipart Messages MIME multipart messages within the Content-Type adds considerable flexibility. • There are four subtypes for a multipart message. The four subtypes are: • mixed: allows a single message to contain multiple, independent sub-messages each having its independent type and encoding. • alternative: allows a single message include multiple representations of the same data.

  19. MIME Multipart Messages • parallel: allows a single message to include subparts that should be viewed together. (such as video and audio subparts) • digest: allows a single message to contain a set of other messages. • To summarize, a multipart message can contain both a short text explaining the purpose of the message and some non-textual information

  20. From: carrieerpdgns@yahoo.com To: john@example.com MIME-Version: 1.0 Content-Type: Multipart/Mixed; Boundary=StartOfNextPart --StartOfNextPart Content-Type: text/plain Content-Transfer-Encoding: 7bit John, Here is the photo of the carrier pigeons I saw last week. Sincerely, Carrie Erpigeons --StartOfNextPart Content-Type: image/gif Content-Transfer-Encoding: base64 ..data for the image.. The keyword “Boundary=“ is used to separte parts of the message. StartOfNextPart is used to serve as the boundary.

  21. E-mail attachments • An e-mail client can allow you to add attachments to e-mails you send and to save attachments from e-mails you receive. • An attachment usually is not text. (Otherwise, it would be added in the body of the message) Attachments can be referred to as a word document, sound files, images, or pieces of software. • Since e-mail messages can only contain textual information, it can produces a problem.

  22. E-mail attachments • Solutions: • Solve problem by using a program called uuencode. • It assumes that the file contains binary information. • It extracts three bytes from the binary file and converts it to four text characters. • uuencode produces an encoded version of the original binary file containing only text characters. • recipient would save the uuencoded version of the message to a file and run uudecode to translate it back to binary. • Since uuencoding and uudecoding messages have been done in the early days of e-mail, most modern e-mail clients run uuencode and uudecode for you automatically.

  23. Introduction to SMTP • The TCP/IP Protocol specifies a standard for the exchange of mail between machines. This standard specifies the exact format of messages a client on a single machine uses to transfer mail to a server on another. • This standard transfer protocol is known as the Simple Mail Transfer Protocol. (SMTP) The main objective of SMTP is to provide the reliability and efficiency of mail transfer.

  24. Introduction to SMTP What should or what shouldn’t SMTP specify? • SMTP basically focuses on how the underlying mail delivery system passes messages across an internet from machine to machine. • SMTP does not specify how the mail system accepts mail from a user or how the user interface presents messages. It also does not specify how mail is stored or how frequent a mail system accepts to send messages.

  25. Introduction to SMTP • An important feature of SMTP is "mail relaying." Mail relaying is SMTP's capability of transporting across networks. • Through SMTP, a process can transfer mail to another process using the same or other networks via a relay process accessible to both networks. • Mail messages can be passed through a number of intermediate relay or gateways hosts from sender to ultimate destination.

  26. Basic SMTP Design User Client SMTP Server SMTP SMTP Commands/Replies and Mail File System File System

  27. Relaying • A relay SMTP server is usually the target of a DNS MX record that designates it, rather than the final delivery system. The relay server may accept or reject the task of relaying the mail in the same way it accepts or rejects mail for a local user. • If it accepts the task, it then becomes an SMTP client, establishes a transmission channel to the next SMTP server specified in the DNS, and sends it the mail. • If it declines to relay mail to a particular address for policy reasons, a 550 response should be returned.

  28. Relaying • If an SMTP server has accepted the task of relaying the mail and later finds that the destination is incorrect or that the mail cannot be delivered for some other reason, then it MUST construct an "undeliverable mail" notification message and send it to the originator of the undeliverable mail (as indicated by the reverse-path).

  29. Mail Gatewaying • A "gateway" SMTP system (usually referred to just as a "gateway") receives mail from a client system in one transport environment and transmits it to a server system in another transport environment. • Differences in protocols or message semantics between the transport environments on either side of a gateway may require that the gateway system perform transformations to the message that are not permitted to SMTP relay systems. Firewalls that rewrite addresses should be considered as gateways, even if SMTP is used on both sides of them.

  30. Address Verification • In some hosts the distinction between a mailing list and an alias for a single mailbox is a bit fuzzy, since a common data structure may hold both types of entries, and it is possible to have mailing lists containing only one mailbox. • SMTP provides commands to verify a user name or obtain the content of a mailing list. • The VRFY and EXPN commands, which have character string arguments, are commands that can be used to verify mailboxes or mailing lists.

  31. Address Verification • When normal responses are returned from a VRFY or EXPN request, the reply normally includes the mailbox name, i.e., "<local-part@domain>“ or “User Name <local-part@domain>”, where "domain" is a fully qualified domain name

  32. VRFY Command VRFY Responses from Server: 553 User ambiguous or 553- Ambiguous; Possibilities are 553-Joe Smith <jsmith@foo.com> 553-Harry Smith <hsmith@foo.com> 553 Melvin Smith <dweep@foo.com>

  33. EXPN Example C: EXPN Example-People S: 250-Jon Postel <Postel@isi.edu> S: 250-Fred Fonebone <Fonebone@physics.foo-u.edu> S: 250 Sam Q. Smith <SQSmith@specific.generic.com> or C: EXPN Executive-Washroom-List S: 550 Access Denied to You.

  34. EHLO Command • A client SMTP SHOULD start an SMTP session by issuing the EHLO command. • If the SMTP server supports the SMTP service extensions it will give a successful response, a failure response, or an error response. • If the SMTP server, in violation of this specification, does not support any SMTP service extensions it will generate an error response.

  35. HELO Command • Older client SMTP systems may use HELO (as specified in RFC 821) instead of EHLO, and servers MUST support the HELO command and reply properly to it. • In any event, a client MUST issue HELO or EHLO before starting a mail transaction.

  36. Mail Command • This command is used to initiate a mail transaction in which the mail data is delivered to an SMTP server which may, in turn, deliver it to one or more mailboxes or pass it on to another system (possibly using SMTP). • The argument field contains a reverse-path and may contain optional parameters. • The reverse-path consists of the sender mailbox.

  37. RCPT Command • The RCPT (Recipient) command is used to identify an individual recipient of the mail data; multiple recipients are specified by multiple use of this command. • The argument field contains a forward-path and may contain optional parameters.

  38. DATA Command • The receiver normally sends a 354 response to DATA, and then treats the lines following the command as mail data from the sender. • The mail data may contain any of the 128 ASCII character codes, although experience has indicated that use of control characters other than SP, HT, CR, and LF may cause problems and SHOULD be avoided when possible.

  39. DATA Command • The mail data is terminated by a line containing only a period, that is, the character sequence "<CRLF>.<CRLF>" or "<CR><LF>.<CR><LF>"

  40. NOOP Command • This command does not affect any parameters or previously entered commands. • It specifies no action other than that the receiver send an OK reply.

  41. RSET Command • The RSET (Reset) command specifies that the current mail transaction will be aborted. • Any stored sender, recipients, and mail data MUST be discarded, and all buffers and state tables cleared. • The receiver MUST send a "250 OK" reply to a RSET command with no arguments. A reset command may be issued by the client at any time.

  42. QUIT Command • This command specifies that the receiver MUST send an OK reply, and then close the transmission channel. • The QUIT command may be issued at any time.

  43. SMTP Example

  44. Terminating Sessions and Connections • An SMTP connection is terminated when the client sends a QUIT command. The server responds with a positive reply code, after which it closes the connection. • If a server receives unknown commands it should not terminate connection, but it should issue a 500 reply and await further instructions from the client.

  45. Terminating Sessions and Connections • An SMTP server MUST NOT intentionally close the connection except: - After receiving a QUIT command and responding with a 221 reply. - After detecting the need to shut down the SMTP service and returning a 421 response code. This response code can be issued after the server receives any command or, if necessary, asynchronously from command receipt (on the assumption that the client will receive it after the next command is issued).

  46. SMTP Replies • Replies to SMTP commands serve to ensure the synchronization of requests and actions in the process of mail transfer and to guarantee that the SMTP client always knows the state of the SMTP server. • Every command MUST generate exactly one reply.

  47. Size Limits and Minimums • Local part: 64 characters • Domain: 255 characters • Path: 256 characters • Command line: 512 characters • Text line: 1000 characters • Message content: 64K octets

  48. Errors reported byreply codes. • Errors reported by reply codes. • Examples: • 500 Line too long. • 501 Path too long. • 452 Too many recipients. • 552 Too much mail data. • In RFC 821 there were errors in the reply codes

  49. Timeouts • Initial 220 Message: 5 minutes. • Mail Command: 5 minutes. • RCPT Command: 5 minutes. • DATA Initiation: 2 minutes. • Data Block: 3 minutes. • DATA Termination: 10 minutes.

More Related