Download Dynamic C TCP/IP

Transcript
9. POP3 Client
Post Office Protocol version 3 (POP3) is probably the most common way of retrieving e-mail
from a remote server. Most e-mail programs, such as Eudora, MS-Outlook, and Netscape’s e-mail
client, use POP3. The protocol is a fairly simple text-based chat across a TCP socket, normally
using TCP port 110.
There are two ways of using POP3.LIB. The first method provides a raw dump of the incoming
e-mail. This includes all of the header information that is sent with the e-mail, which, while sometimes useful, may be more information than is needed. The second method provides a parsed version of the e-mail, with the sender, recipient, subject line, and body text separated out.
In both methods, each line of e-mail has CRLF stripped from it and ‘\0’ appended to it.
9.1 Configuration
The POP3 client can be configured through the following macros:
POP_BUFFER_SIZE
This will set the buffer size for POP_PARSE_EXTRA in bytes. These are the buffers that
hold the sender, recipient and subject of the e-mail. POP_BUFFER_SIZE defaults to 64
bytes.
POP_DEBUG
This will turn on debug information. It will show the actual conversation between the device and the remote mail server, as well as other useful information.
POP_NODELETE
This will stop the POP3 library from removing messages from the remote server as they
are read. By default, the messages are deleted to save storage space on the remote mail
server.
POP_PARSE_EXTRA
This will enable the second mode, creating a parsed version of the e-mail as mentioned
above. The POP3 library parses the incoming mail more fully to provide the Sender, Recipient, Subject, and Body fields as separate items to the call-back function.
Chapter 9: POP3 Client
325