Application Layer

2.4 Electronic Mail in the Internet

Home
Introduction
2.1 Principles of Network Applications
2.1.1 Network Application Architectures
2.1.2 Processes Communcating
2.1.3 Application-Layer Protocols
2.1.4 What Services Does an Application Need?
2.1.5 Services Provided by the Internet Transport Protocols
2.2 The Web and HTTP
2.2.1Overview of HTTP
2.2.2 Nonpersistent and Persistent Connections
2.2.3 HTTP Message Format
2.2.4 User-Server Ineraction: Cookies
2.2.5 HTTP Content
2.2.6 Web Caching
2.2.7 The Conditional GET
2.3 File Transfer: FTP
2.3.1 FTP Commands and Replies
2.4 Electronic Mail in the Internet
2.4.1 STMP
2.4.2 Comparison with HTTP
2.4.3 Mail Message Formats and MIME
2.4.4 Mail Access Protocols
2.5 DNS--The Internet's Directory Service
2.5.1 Services Provided by DNS
2.5.2 Overview of How DNS Works
2.5.3 DNS Records and Messages
2.6 P2P File Sharing
2.7 Socket Programming with TCP
2.7.1 Socket Programming with TCP
2.7.2 An Example Client/Server Application in Java
2.8 Socket Programming with UDP

2.4.3 Mail Message Formats and MIME

When an e-mail message is sent from one person to another, a header containing peripheral information precedes the body of the message itself.  THis peripheral informaiton is contained in a series of header lines.  The header lines and the body of the message are seperated by a blank line.  As with HTTP, each head line conatins readable text, consisting of a keyword followed by a colon followed by a value.  Some of the keywords are required and others are optional.  Every header must have a From: header liner and a To: header line; a header may include a Subject: header line as well as other optional header lines.  It is important to note that these header lines are different from the SMTP commands.
 
The MIME Extension for Non-ASCII Data
While the message headers are satisfactory for sending ordinary ASCII text, they are not sufficiently rich for multimedia messagese or for carrying non-ASCII text formats.  To send content other than ASCII text, the sending user agent must include addtional header in the message. 
 
The two key MIME headers for supporting multimedia are the Content-Type : header and the Content-Transfer-Encoding: hearer.  The Content-Type: header allows the receiving user agent to take an appropriate action on the message.
 
By indicating that the message body contains a JPEG image, teh receiving user agent can direct the message body to a JPEG decompression routine.  To understand the need for the Content-Transfer-Encoding: header, recall that non-ASCII text messages must be encoded to an ASCII format that isn't going to confuse SMTP.  The Content-Transfer-Encoding: header alerts the receiving user agent that the message body has been ASCII-encoded and indicates the type of encoding used.  When a user agent receives a messsage withthese two headers, it first uses the value of the Content-Transfer-Encoding: header to convert the message body to its original non-ASCII form, and then uses the Content-Type: header to determine what actions it should take on the message body.
 
The Received Message
The receiving server appends a Received: header line to the top of the message; this header line specifies the name of the STMP server that sent the message, the name of the SMTP server that received the message, and the time at which the receiving server received the message.