POP3c_MsgRead()
Reads and structures a message previously retrieved from a POP3 server.
Files
pop3-c.h/pop3-c.c
Prototype
void POP3c_MsgRead (CPU_CHAR *msg_buf, CPU_INT32U buf_size, POP3c_MSG *msg, NET_ERR *perr);
Arguments
msg_buf
Buffer containing a message received with POP3c_MsgRetrieve()
.
buf_size
Size of msg_buf
.
msg
Pointer to POP3c_MSG
structure being filled by this function.
perr
Pointer to a variable that will hold the return error code from this function:
Returned Values
None.
Required Configuration
None.
Notes / Warnings
- From RFC #2822 (Internet Message Format), Section ‘Lexical Analysis of Messages : General Description’, “The body is simply a sequence of characters that follows the header and is separated from the header by an empty line (i.e., a line with nothing preceding the CRLF)”. Hence,
GetLine()
will return a length of 2 when it encounters that delimitation. - Characters
<CRLF>
are not copied into the various structure’s header fields. Instead, a ‘\0
’ character is appended. - The leading WSP (after the comma) is (are) not copied into the various structure’s header fields.
- If the character ‘
\0
’ is found in themsg_buf
before the end of the header, it means that buffer, and hence the message, is incomplete. However, there is no way to know if the message body was complete. One should always check the return value ofPOP3c_MsgRetrieve()
for confirmation.
Example Usage
See Sample Application.