Sending and Receiving Email
By Al Williams
Email's popularity isn't a surprise. It's one of the oldest Internet applications, and provides an efficient alternative to the telephone or fax. In its simplest form, email originates as a person-to-person message transferred from one client, through a number of servers, to a second client. There are, however, a growing number of email exchanges that don't follow this model. It's common to encounter gateways that will fetch Web pages and return them as formatted email messages. Many server applications can create and send messages to specified users, for example, to notify them if something goes wrong. And there are even agents that will process and reply to incoming mail without human interaction.
Judging from the reader response to my February 2000 and December 2000 columns, maintaining email functionality is a common request, and developers often find themselves rewriting mail objects for each new program they build. As I discussed in those articles, it's possible to capture relevant SMTP functions in reusable objects that can be used to send email. But what about receiving email? The idea is much the same, but instead of using SMTP, clients use Post Office Protocol version 3 (POP3).
Many email clients, like Netscape Messenger, Microsoft Outlook, and Eudora Pro, use POP3 to download messages from an email server. (A newer scheme called IMAP can also be used, but POP3 is by far the most common.) Your email program communicates with a POP3-enabled server and retrieves email via a process outlined in RFC 1939.