Xbasic

EMAIL_POP_RETR Function

Syntax

Result_Flag as L = email_pop_retr(P pResult, P pSocket, N nMessage [, L lDelete [, N nBlockSize [, L lStatus]]])

Arguments

pResultPointer

A pointer variable that is populated by this function. Will contain the following:

pMessage Component
Description
.headers

Contains the headers for the entire message.

.message

contains the entire text of the message

.nBytes

contains the number of bytes that the server reported is in the message

.content_type

has the value of the "content-type:" field from the headers.

.parts

If the message has many parts (Content-Type: Multipart/Alternative or similar), there will be an array named parts in the pMessage structure. Each element of this array contains: headers, message, content_type, and perhaps another parts array. The parts array will usually be there if the message contains html or attachments, as is seen below.

pSocketPointer

A pointer variable that is populated by EMAIL_POP_OPEN().

nMessageNumeric

The message number that you want to retrieve from the server.

lDeleteLogical

Default = .F. .T. = The message will be deleted from the server after it is downloaded .F. = The message is not deleted.

nBlockSizeNumeric

Default = 64KB. The number of bytes that should be retrieved from the server at one time.

lStatusLogical

 

Returns

Result_FlagLogical

.T. = The message was successfully downloaded. .F. = The message was not downloaded.

Description

The EMAIL_POP_RETR() function retrieves a single message from a POP3 server. The connection must have been previously opened with EMAIL_POP_OPEN(). , i.e. the pSocket.s must be an open connection

Example

DIM pSocket as P
DIM pMessage as P
? email_pop_open(pSocket, "mail.mycompany.com",  "john_doe", "sneaky")
= .T.

? pSocket.nMessages
= 5

? email_pop_retr(pMessage, pSocket, 2)
= .T.

? properties_enum(pMessage)
= headers
message
nBytes
content_type
parts

Example 2

? pMessage.content_type
= "Multipart/Mixed"

? pMessage.parts1.content_type
= "Multipart/Alternative"

? pMessage.parts1.parts1.content_type
= "Text/Plain"

? pMessage.parts1.parts1.message
= "This is a plain text email"

? pMessage.parts1.parts2.content_type
= "Text/Html"

See Also