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.4 Mail Access Protocols

Once STMP delivers the messge, the message is placed in a mailbox.  Mail access uses a client -server architrcture--thetypical user reads e-mail with a client that executes on the user's end system.  By execut8ing a mial client on a local PC, users enjoy a rich set of features, including the ability to view multimedia messages and attachments.
 
Consider the path an e-mail message takes when it is sent from the sender to the receiver.  At some point along the path the e-mail messge needs to be deposited in the receiver's mail server.  This could be done simply by having the sender's user agent sent the message directly to the receiver's mail server.  And this could be done with SMTP--indeed, SMTP has been designed for pushing e-mail from one host to another.  The sender's user agent does not dialogue directly with the recipient's mail server.
 
There is still one missing piece to the puzzle!  How does a recipient runnign a user agent on thier local PC, obtain their messages, which are sitting in a mail server within the recipient's ISP?
 
There are currently a number of popular mail access protocols, including Post Office Protocol-Version3 (POP3), Internet Mail Access Protocol (IMAP), and HTTP.
 
 
POP3
POP3 is an extremely simple mail access protocol.  Because the protocol is so simple, its functionality is rather linited. POP3 begins when the user agent opens a TCP connection to the maiul server on port 110.  With the TCP connection established, POP3 progresses through three phases: authorization, transcation, and update.  During the first phase, authorization, the user agent sends a username and a password to authenticate the suer.  During the second phase, the user agent retrieves messges; also during this phase, the user agent can mark massage for deletion, remove deletion marks, and obtain mail statisics.  The third pahse, uspdate, occurs after the client has issued the quit command, ending the POP3 session: at this time, the mail server deletes the message that were marked fro deletion.
In a POP3 transcation, the user agent issues commands, and the server responds to each command with a reply.  There are two possible responses: +OK, used by the server to indicate that the prevcious command was fine; and -EER, used by the server to indicate that something was wrong with the previous command.
 
The authorization phase has two principal commands: user <user name> and pass <password>.
 
IMAP
With POP3 access you can create mail folders and move the downloaded message into the folders.  You can then delete messages, move messages across folders, and serach for messages.
 
An IMAP server will associate each message with a folder; when a message frist arrives at the server, it is associated with the recipient's INBOX folder.  The recipient can then move the message into a new, user-created folder, read the message, delete the message, an so on.  The IMAP protocol provides commands to allow users to create folders and move messges from one folder to another.  IMAP alos provides commands that allow users to search remote folders for messages matching specific criteria.  Unlike POP3, an IMAP server maintaims user sate information across IMAP sessions, the name of the folders and which messages are associated with which folders.
 
Another important feature of IMAP is that it has commands that permit a user agent to obtain components of messages.
 
Web-Based E-mail
More and more users today are sending and accessing their e-mail through their Web browsers.  Now WEb-based e-mail is provided by just about every ISP site as well as every major university and corporation.  With this servies, the user agent is an ordinary Web browser, and the user communicates with its remote mailbox via HTTP.  When a recipient wants to access a message in thier mailbox, the e-mail message is sent from the recipient's mail server the the recipient's browser using HTTP protocol rather that the POP3 or IMAP protocol.
 
This solution to mail access is enormously convenient for the user on the go.  The user need only be able to access a browser in order to send and receive messages.  The browser can be in an Inernet cafe, in a friend's house, on a PDA, in a hotel room with a Web TV, and so on.  As with IMAP, users can organize their messages in a hierachy of folders on the remote server.