Electronic Mail

Electronic mail (email) allows a person to compose a message and to send it to another person who may be a registered user on the same system, or who may be on a remote system. It also provides software to facilitate reading, saving, printing and replying to email. Electronic mail is still the single biggest generator of traffic volume on the Internet. On the Department of IT systems, there are many options for the user agent part of the email system. They include:
mail, Mail
the original (BSD Unix) mail agent. Unbelievably primitive by today's standards, but still with some useful features.
elm
the original "graphical" (screen-oriented) mail agent, and considered by many discerning punters as still the best.
pine
a screen-based agent with similarites to elm, but easier to use and (depending on your point of view :) less powerful.
Zmail
also called "Media Mail" on the SGI systems, very powerful, fully graphical and highly recommended. Requires a graphics workstation, which is a serious restriction.

RFC 822 Message Format

RFC822 defines the structure of an email message in the Internet. It has become the generic standard for email messages.

It defines a message which has two parts:

  1. A set of headers, some of which are are mandatory and others optional. The headers have a fixed format, consisting of a keyword which starts immediately after a newline, followed by a colon character, followed by a space and a value. Some headers include:
    From: pscott@ironbark
    To: boc@ironbark
    Reply-to: p.scott@latrobe.edu.au
    Subject: Problems in Indy lab?
    
  2. A body, which may contain any plain ASCII text. The body part follows the headers, separated by a blank line. There are certain rules which ensure that no line in the body can be mistaken for a header line, even though the two parts are logically distinct. Note that more recent standards than RFC822 (MIME) extend the range of possible messages which can be sent by email as enclosures.

Electronic Mail Addresses

Electronic mail addressing is an excellent example of how the world has become a much simpler place in recent years, with the increase in use of the global Internet.

An Internet email address is always of the form:

local-part@domain-name
For example:
pscott@ironbark.bendigo.latrobe.edu.au
We shall return to the topic of domain names later in this unit. For the moment, a domain name should be interpreted as the hierarchical name of a computer system where the "local part" of the email address is a registered user.

Occasionally, one sees a form of Internet mail address where a mail gateway is specified, thus:

pscott%ironbark@latrobe.edu.au
This (hypothetical) example means that the username "pscott" and the machine name "ironbark" have significance to the mail software at a gateway called "latrobe.edu.au", which is where the mail gets delivered to. Such addresses are sometimes found where the desination user is not on an Internet-connected system.

The SMTP Protocol

The Simple Mail Transfer Protocol defined in RFC821 specifies how mail is delivered from one system to another. It is a very straightfoward protocol.

Initially, an email client (usually the delivery agent software on the originating machine) establishes a TCP connection to the SMTP server (at port 25) on the destination machine.

The server responds with an informative message beginning with the 3-digit code 220. The client then sends a HELO command identifying the domain name of the system it is running on.

Then the client software transmits one (or more) mail messages to the server. Each message is preceded by a MAIL-FROM and one or more RCPT-TO messages. The responses to these messages begin, as usual, with 3-digit numbers followed by a human readable message. Then the text of the message itself (including its headers) is transmitted using a DATA message.

Finally, a QUIT message from the client tells the server to close the TCP connection. An example of this is given on the next slide.


An SMTP Session

NB: Text in italics is sent from the client. Note that messages from the server always have a 3-digit code at the start of line.
220 redgum.bendigo.latrobe.edu.au ESMTP Sendmail 8.7.3/8.7.3; Mon, 25 Mar 1996 8:16:33 +1000 (EST)
helo bindi.bendigo.latrobe.edu.au
250 redgum.bendigo.latrobe.edu.au Hello bindi.bendigo.latrobe.edu.au, pleased to meet you
Mail from: pscott@bindi.bendigo.latrobe.edu.au
250 pscott@bindi.bendigo.latrobe.edu.au... Sender ok
Rcpt to: pscott@ironbark.bendigo.latrobe.edu.au
250 Recipient ok
Data
354 Enter mail, end with "." on a line by itself
Subject: Problem with ironbark?
From: pscott@bindi.bendigo.latrobe.edu.au
Reply-to: p.scott@latrobe.edu.au

Is there a problem?

Regards
.
250 IAA13317 Message accepted for delivery
quit
221 redgum.bendigo.latrobe.edu.au closing connection

Other Aspects

There are many subtleties involved in electronic mail. These include:

Intro To MIME

The Multipart Internet Mail Extensions specification extends the SMTP protocol to allow the mail message body to contain arbitrary data, encoded in ASCII for transmission. This allows SMTP to be used for file transfers, and to permit enclosures with mail message. A typical MIME message to send a file might look like:
From: p.scott@latrobe.edu.au
To: donald@duckburg.net
MIME-Version: 1.0
Content-Type: image/gif
Content-Transfer-Encoding: base64

    ...data for the image...
More commonly, files are sent as enclosures, using the multipart MIME content type, thus:
From: p.scott@latrobe.edu.au
To: donald@duckburg.net
MIME-Version: 1.0
Content-Type: Multipart/Mixed; Boundary=StartNextBit

--StartNextBit
Hello Don, here's some voice mail for you
Phil
--StartNextBit
Content-Type: audio/basic
Content-Transfer-Encoding: base64
    ...data for the image...

The Post Office Protocol (POP)

SMTP is really only useful to deliver mail to multiuser hosts which are permanently available and connected to the network. It is not normally used to deliver mail directly to, for example, a user's PC or Mac system. However, people who use these types of system still want to use email without the complexity of mainframe mail agent software.

The Post Office Protocol is designed to allow mail to be delivered to a mailbox on, eg, a Unix host using SMTP, but to later (at the user's convenience) download the contents of the mailbox to the user.

A POP client (such as Eudora or POPmail) establishes a TCP connection (port 110) to a server process on the (eg) Unix system. The user is authenticated (username/password), and the contents of her mailbox is downloaded for processing on the PC or Mac.

POP is universally used where a user has "dial up" Internet access from a commercial Internet Service Provider - the user's mailbox is maintained by the ISP.

Author's Opinion: The use of POP should, eventually, remove the need for proprietory mail systems which were previously used on networks of PCs and Macs.


This lecture is also available in PostScript format. The tutorial for this lecture is Tutorial #05.
Phil Scott