POP3 and SMTP Email

POP3 is Post Office Protocol for collecting email. SMTP is Simple Mail Transfer Protocol for sending email.

Post Office Protocol 3

POP3 allows you to leave email on a mail server, in a store and forward manner, and access it using various different client computers. POP3 uses Port 110 (the earlier POP2 used 109). It was defined in November 1994, in RFC 1725. There is a newer standard, Internet Message Access Protocol (IMAP4) however although said to be gaining ground, I haven't seen it used.

The commands used by POP3 are fairly simple, and you can simply log into Port 110 using Telnet, and manually collect your email in an emergency, or just to see what is happening.

There are three phases to a POP3 session.

Authentication
User name and password
Transaction
Retrieve messages, mark messages to be deleted, statistics shown
Update
After the quit command from the mail client, the message store is updated and the session ends.

You connect using telnet mailserver.domain 110

The commands available then are

Don't feed POP3 an empty line and CR. Use noop instead.

Many email clients keep track of which messages they have already downloaded. If you delete this file, all messages still held on the server will be downloaded again. For Eudora, the file is lmos.dat. For Outlook Express it is pop3uidl.dat. All online mail readers store equivalent files somewhere. I still need to find the EPOC version.

Packet Eater posts in the Psion newsgroups in 2002: Got it to work ok on my Psion and a manual telnet connect. Out if interest trying it on a win98 machine it just wont have it ! Who care, I can do it on my Revo and my old dos Minuet browser for the pc. Shame there is no command to list the message titles on telnet :-(

Simple Mail Transport Protocol

The actual commands used by SMTP are fairly simple, and were described in detail RFC 821. The types of contents were set out in RFC 822. A number of ASCII header lines terminated by a CRLF. A blank line. The ASCII text message follows in lines that should be less than 78 characters. They must be less than 998 characters. To end, a CRLF, then a full stop followed by a CRLF.

You can simply log into Port 25 using Telnet, and manually send your email in an emergency, or just to see what is happening.

You connect using telnet mailserver.domain 25 (possibly with a colon or comma before the port number).

HELO mail.mailsender

mail from: <name@validaddress>
rcpt to: <recipient@theiraddress>
data
your message here
.
quit

The SMTP commands listed by RFC 821 are:

HELO <SP> <domain> <CRLF>
MAIL <SP> FROM:<reverse-path> <CRLF>
RCPT <SP> TO:<forward-path> <CRLF>
DATA <CRLF>
RSET <CRLF>
SEND <SP> FROM:<reverse-path> <CRLF>
SOML <SP> FROM:<reverse-path> <CRLF>
SAML <SP> FROM:<reverse-path> <CRLF>
VRFY <SP> <string> <CRLF>
EXPN <SP> <string> <CRLF>
HELP [<SP> <string>] <CRLF>
NOOP <CRLF>
QUIT <CRLF>
TURN <CRLF>

More recent variations and expansions of the RFC. Messages can be considered to have envelopes (the header material), and contents.

RFC 2821
Updates RFC 821. This is about the envelope (or header) of the message. Covers the protocol Internet mail servers implement and use. Minimum command set EHLO, HELO, MAIL, RCPT, DATA, RSET, NOOP, QUIT, VRFY
RFC 2822
Updates RFC 822. The syntax within the text message, as distinct from the envelope used for delivery details. The basic message format used in email messages. It does not cover anything except text. See the RFCs about MIME extensions for attachments.
RFC 2920
SMTP extension to improve SMTP performance by bundling multiple commands within a TCP send operation.
RFC 3030
Two extensions to the SMTP protocol for the transfer of large and binary MIME messages. Provides the BDAT alternative for MIME extentions, as an alternative to the text only DATA command.
RFC 2487
SMTP extension for transport-layer security during sessions. Email is mostly like a postcard, in that it can easily be read during transport. This adds some security to email while in transit.

If sending material that is not ASCII text, one alternative is to encode it into ASCII. Encodings used include pure hexadecimal, uuencode, the 3-in-4 base 64 scheme specified in RFC 1421, and many others.

If transmitting images, audio, or structured data via electronic mail the MIME series [RFC2045 to RFC2049] either extend the syntax or structure messages to conform to RFC 2822.

RFC 2045 Multipurpose Internet Mail Extensions
Covers MIME version headers, specifies the media type
RFC 2046
RFC 2047
RFC 2048
RFC 2049

I found a site by Daniel R. Tobias that does a much better job of explaining how all this email stuff works than I would ever essay, so check mailformat.dan.info/

I hope you have enjoyed www.ericlindsay.com.