Programmer's Guide to Internet Mail: SMTP, POP, IMAP, and LDAP


Programmer's Guide to Internet Mail will help you create and manage network applications using powerful Internet mail, directory, and domain name protocols and standards. It succinctly explains from a programmer's perspective not simply the primary Internet mail protocols but also how to use other important network protocols such as LDAP and DNS vital to the creation of message-enabled applications. Readers will learn how these protocols and standards facilitate message submission, delivery and retrieval, support...

See more details below
$81.90 price
(Save 16%)$97.95 List Price
Other sellers (Paperback)
  • All (8) from $12.49   
  • New (3) from $91.05   
  • Used (5) from $12.49   
Sending request ...


Programmer's Guide to Internet Mail will help you create and manage network applications using powerful Internet mail, directory, and domain name protocols and standards. It succinctly explains from a programmer's perspective not simply the primary Internet mail protocols but also how to use other important network protocols such as LDAP and DNS vital to the creation of message-enabled applications. Readers will learn how these protocols and standards facilitate message submission, delivery and retrieval, support directory lookup, how they interoperate, and how they together create a framework for sophisticated networked applications.

Programmer's Guide to Internet Mail will help you select the right protocol, or combination of protocols, for a specific programming function. Written by an expert e-mail and messaging consultant from Compaq, this insightful book is loaded with sample code you can use to begin and accelerate application development.

Master the primary Internet mail and directory protocols
Understand the interaction between Internet messaging clients and servers
Troubleshoot e-mail network problems

Audience: Application developers of mail and mail-enabled software, administrators, and those considering mail-enabling their programs.

Read More Show Less

Editorial Reviews

From the Publisher
. . .is ideal for anyone new to computer network development and administration.
-Reviewer's Bookwatch
Describes from a programmer's perspective the primary Internet mail, directory, and domain name protocols and standards, and explains how to use other important network protocols vital to creating message- enabled applications. Includes discussions of how protocols and standards facilitate message submission, delivery and retrieval; support directory lookup; interoperate; and create a framework for sophisticated networked applications. Includes no bibliography. Annotation c. Book News, Inc., Portland, OR (
From The Critics
John Rhoton's Programmer's Guide To Internet Mail will enable the reader to master the primary Internet mail and directory protocols, understand the interaction between Internet messaging clients and servers, be able to troubleshoot their way through email network problems, learn to messageenable networked applications, gain a protocolbased Visual Basic code, and in general, learn to program with mail message formats RFC822 and MIME; message transfer protocols SMTP and DNS, post office protocols POP3 and IMAP, directory protocols ASN and LDAP, as well as other leading protocols.. Programmer's Guide To Internet Mail is ideal for anyone new to computer network development and administration.
Read More Show Less

Product Details

  • ISBN-13: 9781555582128
  • Publisher: Elsevier Science
  • Publication date: 10/22/1999
  • Series: HP Technologies Series
  • Pages: 291
  • Product dimensions: 0.65 (w) x 9.61 (h) x 6.69 (d)

Meet the Author

John Rhoton is currently a Principal Member of Technical Staff in Hewlett Packard's Consulting and Integration practice. He also has many years of experience as a Technology Consultant and Solution Architect in Compaq's Emerging Technologies and Applied Microsoft Technologies Groups, with a special interest in messaging systems. His other Digital Press books include The Wireless Internet Explained (2002), X.400 and SMTP: Battle of the E-mail Protocols (1997) and Programmer's Guide to Internet Mail (2000).

Read More Show Less

Read an Excerpt

Chapter 2: Network Protocols

It is possible to write mail-enabled programs and manage E-mail networks with only a limited understanding of networks and their underlying protocols. Nevertheless, the more you know about the building blocks of your system the better you can understand why things work the way the do (or don't). This can only help you to do your job better.

I have tried to isolate some of the components of the Internet networking protocols that I think might be of value. Beyond these, you may wish to consult literature specifically targeted to networks.

Networking protocols address a number of challenges at the same time:

1. How do we allow multiple applications to share a link using a single physical medium (wire, air, optical cable, etc)? (Multiplexing)

2. How do applications synchronize operation with their counterparts on the remote machines? (Flow Control)

3. When there are multiple hosts and network lines, how do we deter mine the path for communication to our remote correspondent? (Addressing, Routing)

4. How do we recover from errors in transmission? (Checksums, Retransmission)

Given the complexity of each of these issues, we obviously need to structure our networks to ensure that we are able to satisfactorily address all such needs.

Networks have been historically organized into layers as a way of decomposing and modularizing their functionality. Today the most accepted model for networks is called the OSI model. Virtually all networking architectures describe their components in terms of how they fit this model.

IP Stack

If you look at Figure 2.1 you will see that the Internet protocols do notmatch the model exactly. Most network designers today would acknowledge that the model is top-heavy. In other words, there are too many layers at the top and not enough at the bottom. Consequently, we will find that the protocols we'll be looking at in this book are comparatively simple, yet span several OSI (Open Systems Interconnect) layers. At the same time, the data-link layer (which we can take for granted) has to provide multiple complex functions. I guess we are just lucky!

Internet Protocol

IP (Internet Protocol) is specified in RFC 791 and operates at the network layer. The primary purpose of this layer is to take packages of data and transfer them to their destination. If you look at Figure 2.21 you will notice the highlighted fields indicating the source and destination addresses. The network module of each node looks at the destination address of each packet and then decides where to send the packet next by looking up the shortest path in its routing tables.

Most of the other fields are not of interest to us. IP also does some basic error checking and fragmentation to pass through dissimilar networks, but essentially IP takes no responsibility for delivering its datagrams or for notifying the sender if anything goes wrong. It is fun being an IP module. If you don't like the data you receive you can just ignore it!

The only other field we are interested in is the protocol. Since there are multiple transport-level protocols on most nodes, the receiving IP must know to whom to give each packet when it receives it. In our case, this will usually be TCP (Transmission Control Protocol). The value of the protocol field is 6 if the protocol is TCP, although in the real world you might also encounter a substantial amount of UDP (User Datagram Protocol) (value of 17).

Transmission Control Protocol

Like IP, TCP also offers a few functions that need not overly concern us (Figure 2.3). It ensures that packets are given to the application in the order they were sent, as well as providing for flow control and more complete error-checking. Of interest to us is what RFC 793 calls multiplexing. just as IP was able to transfer incoming packets to various transport layers (TCP or UDP) depending on the protocol number, so TCP also has a number of upper-layer applications to deal with. To accommodate all of them at once, each application must request a port from the TCP module. Any requests coming into the port are held by TCP and can be read by the application. Similarly, any outgoing messages are sent by the application to the port, and TCP takes the responsibility to send them on to the destination application.

In Table 2.1 you can see the ports that we will be dealing with in our testing. Note that there is no technical restriction on which port each protocol can use. However, both client and server must agree on the same port. Since virtually all clients and servers in the industry use these ports, you will want to keep to the standard to interoperate with them.

TCP also defines a socket, which may some times be confused with a port (Table 2.2). It is essentially a specific port on a specific node or the combination of IP address and port number.

Another important term is the connection. A socket can have multiple connections from different nodes or even different ports on the same node. We call the association of two sockets with each other a connection.


If you look at Figure 2.4, you will see the data structure you need to give your network interface in order to issue the SMTP command "HELO." Clearly, if you had to fill out these structures each time you wanted to send a command you would not be too pleased. This is the reason for compartmentalizing the network into modules. You can call the TCP module rather than having to replicate its functionality in your code.

Even so, every system and TCP implementation could conceivably have a different interface putting the burden back on you to develop versions of your program that work on every available protocol stack. The 4.2 version of BSD UNIX addressed this issue by defining a common programming interface for networking operations. It was loosely based on the UNIX approach to reading and writing files but addressed the needs of network users.

This API (Application Programming Interface) was called Berkeley Sockets and was eventually ported to many different operating systems. The name originated because its principal data structure was called a socket. Note that this socket is not simply a host-port combination as we discussed earlier. In this context, a socket is one end of a communications link. It holds all the information related to the link (including addresses, queues, and data buffers). Most socket-calls require a socket descriptor, also called a socket. The socket descriptor will be the usual meaning of the word socket in this book.

Early Windows applications did not have a socket library available to them. Each application had to program to the API of the TCP/IP stack of the vendor, much like users of other operating systems before Berkeley Sockets. In 1993, Microsoft and others produced a specification called Winsock, which was closely based on Berkeley Sockets. There are some additional functions (starting with WSA [Windows Socket API]), but the rest closely match the Berkeley specifications, making it easy to write portable code.

In Table 2.3 and Table 2.4 you can see the set of functions defined by Sockets and Winsock respectively. On 32-bit Windows systems (e.g., Windows 95, Windows 98, Windows NT) they are stored in a library called wsock32.dll, usually found in the Windows path....

Read More Show Less

Table of Contents

Internet Mail; Network Protocols; Generic Utilities; RFC822: Internet Text Messages; MIME: Multipurpose Internet Mail Extensions; SMTP: Simple Mail Transfer Protocol; DNS; POP3: Post Office Protocol; IMAP: Interactive Mail Access Protocol; ASN.1: Abstract Syntax Notation One; LDAP: Lightweight Directory Access Protocol; The Complete Picture; Appendix A: Library Functions; Appendix B: Sample Code

Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Terms of Use.
  • - Barnes & reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously

    If you find inappropriate content, please report it to Barnes & Noble
    Why is this product inappropriate?
    Comments (optional)