Академический Документы
Профессиональный Документы
Культура Документы
Mail Protocols
Introduction
Mail service is perhaps the most widely used application on the Internet.
Several protocols for mail service are available, but the most widely used is
the Simple Mail Transfer Protocol (SMTP). Because of large number of
mobiles and workstation users on the Internet, other support protocols, such
as POP3 (Post Office version 3) and IMAP4 (Internet Message Access
Protocol version 4), have also been developed.
Mail addresses that are used in SMTP follow the RFC 882 standard. The mail
header is often referred to as 882 headers. An example of an 882 address is
the following:
KSS@SHIVS.COM
The test string before the @ symbol specifies the mailbox name, and the text
string after the symbol specifies the host name. If the mailbox name contains
special characters, such as %, the mailbox name contains a special encoding
that is used by mail gateways. In the mail address of KSS@SHIVA.com, the
text string KSS is the name of the mailbox on host SH IVA.COM.
If you want to send non-text message, such as binary files, audio, or images,
by using SMTP, you can encode the message as a text message by using the
UUENCODE utility that is available on many systems. The receiver will have
to decode the encoded message by using a utility called UUDECODE.
Another way of sending non-text message is to use the MIME protocol. MIME
(Multipurpose Internet Mail Extensions) is described in RFCs 1896 RFC2046
and RFC2049. MIME is used to encode different content types, such as plain
text, richly formatted text, image, audio, video, HTML documents, and so on
(see fig. 13.4).
BRBRAITT Nov-2006 2
“DATA NETWORK” FOR JTOs PH-II : SMTP
Message RFC-822
header
Text
Audio
Message MIME RFC-1341
body
Image
Video
MIME message bodies can have nested contents, and MIME user agents can
select among alternative representations of contents. For example, if a
"dumb" terminal --- which does not have the capability to display an
audio/video message -- is used, the terminal can display the text portion of
this message. Another Useful feature of MIME is that it can use a pointer to
reference data that is stored elsewhere. For example, the pointer can refer to
a document on an FTP site. This process prevents the necessity of including
the document to every mail message that is sent out on a mail distribution list.
Only users that are interested in the document on the FTP site have to
retrieves this document.
Table 13.3
Command Meaning
BRBRAITT Nov-2006 3
“DATA NETWORK” FOR JTOs PH-II : SMTP
<CRLF> <CRLF>.
Table 13.4
Command Meaning
Figure 13.5 shows an SMTP session that uses some of these commands.
Notice that in this example, mail is being sent from the user kss@scs.psi.com
identified by the MAIL command.
BRBRAITT Nov-2006 4
“DATA NETWORK” FOR JTOs PH-II : SMTP
S: HELO machine
R: HELO machine, pleased to meet you
S:
R:
RCPT To: bob@ltree.psi.com
550 No such user here } User bob does not have a
mailbox at ltree.psi.com
S: DATA
R: 354 Start mail input: end with <CRLF> <CRLF>
S: message text
S: message text
S: message text_etc
S: <CRLF> <CRLF>
R: 250 OK
R = SMTP receiver
S = SMTP sender
Table 13.5
BRBRAITT Nov-2006 5
“DATA NETWORK” FOR JTOs PH-II : SMTP
SMTP expects the destination host --- the mail server receiving the mail --- to
be online; otherwise, a TCP connection cannot be established with the
destination host. For this reason, it is not practical to establish an SMTP
session with a desktop for receiving mail because desktop workstations are
often turned off at the end of the day.
Although POP3 is used to download messages from the server, SMTP is still
used to forward messages from the workstation user to its SMTP mail server.
Table 13.6 through 13.8 list the POP3 command based on the RFC 1939
specification. Although the USER and PASS commands (see table 13.7) are
listed as optional commands in RFC 1939, most POP3 implementations
support these commands. The reason why USER/PASS can be regarded as
optional is because they can be replaced by the MD5 (Message Digest
version 5) authentication method used in the APOP command.
BRBRAITT Nov-2006 6
“DATA NETWORK” FOR JTOs PH-II : SMTP
POP3 server
110
SMTP
TCP
POP3
client
IP
TCP/IP
TCP
Internet
IP
User agent
BRBRAITT Nov-2006 7
“DATA NETWORK” FOR JTOs PH-II : SMTP
Table 13.6
Command Meaning
Table 13.7
BRBRAITT Nov-2006 8
“DATA NETWORK” FOR JTOs PH-II : SMTP
Command Meaning
USER name This command is used to specify the name string to
identify a mailbox.
TOP msg n The POP3 server sends an +OK response followed by the
headers of the specific message, msg, than a blank line
followed by n lines in the indicated message body. If the
number of lines requested by the POP3 client is greater
than the number of lines in the message body, the POP3
server sends the entire message.
APOP name digest The name in a string that identifies the mailbox, and digest
is the MD5 (Message Digest version 5) digest string. This
command is used to provide an alternative authentication
method to the normal USER/PASS exchange, which is
sent as clear as text. The APOP authentication method
provides for both origin authentication and reply
protection. More importantly, with APOP, the password is
not sent in the clear over the network.
BRBRAITT Nov-2006 9
“DATA NETWORK” FOR JTOs PH-II : SMTP
Table 13.8
POP3 Server Replies
Command Meaning
Figure 13.7 shows a simple interaction between a POP3 client and a POP
server. The interaction uses some of the commands listed in table 13.6
though 13.8.
C: USER kss
S: +OK kss is a real happy frood
C: PASS mypassword Authorization
S: +OK kss’s maildrop has7 messages (1729 octets) state
C: STAT
S: +OK 7 1729
C: LIST Transaction
S: +OK 7 messages (1729 octets) State
S: 1 340 msgid
S: 2 512 message size • STAT
: • LIST msg
S: 7 59 • RETER msgid
S: <CR>•<LF> Multiline termination • DELE msgid
C: RETR 1
S: +OK 340 octets . POP3 server sends message 1
S: <CR>•<LF>
C: QUIT
S: +OK dewey POP3 server signing off Update
C: <close connection> state
S: <wait for next connection>
S = POP server
C = POP3 client
BRBRAITT Nov-2006 10
“DATA NETWORK” FOR JTOs PH-II : SMTP
This simple POP3 session shows that the POP3 session initially enters into a
connection state. In this connection state, the TCP connection with the POP3
server is established. Next, the POP3 session enters into the authentication
state. In this state, the user must provide a user name and password to be
authenticated by the POP3 server. In earlier POP3 implementations, the user
name and password authentication information is sent to clear text and is
susceptible to compromise, which means that someone examining the POP3
packet can trace & discover the user name and password combination. In
POP3 as specified in RFC 1939, an alternative, more secure authentication
method based on MD5 can be used.
After the user has been authorized, the POP3 session enters the transaction
state. In the transaction state, a number of commands --- such as STAT, LIST,
RETR, DELE, RSET, and so on --- can be issued. In figure 13.7, the POP3
client issues a STAT command, and the server returns the number of
messages with a total size (1,729 octets) of these messages. The POP3
client then uses the LIST command to ask for a list of all the messages. The
POP3 server returns the message numbers for each message and its
corresponding size. The client then issues the RETR command and specifies
each message identifier that is to be downloaded. Depending on the setting
at the POP3 client, the POP3 client may issue a DELE command to delete a
message that has been retrieved.
After the message has been downloaded, the POP3 session enters the
update state. In the update state, the POP3 client issues a QUIT command to
close the connection. Both POP3 client and POP3 server may then update
their internal states to reflect the new count of messages in their respective
mailboxes. The TCP connection is then closed.
BRBRAITT Nov-2006 11