Share this page

# pop3_retrieve

Post Office Protocol Vuser Functions (POP3)

Retrieves messages from the POP3 server.

    long pop3_retrieve( char *transaction, char *retrieveList, [<Options>,] LAST );

transaction | A transaction name for this step in quotes. To instruct VuGen not to create a transaction for this step, use a NULL string, "".
retrieveList | The messages to retrieve. Use the following format: `"RetrieveList=`message1`,`message2,message3...`", where each message is a 1-based index of the message in the list.` To retrieve all messages, use `"RetrieveList=All"`
<Options> | The following options are available:CreateParamForHeader: Create parameter to hold the values of headers. The value of the argument is a comma separated list of header names. The name of the parameter will have the following format: pop3_header_<HeaderName>_<MessageID> The header name is case sensitive.DeleteMail: If set to "yes" (default), it instructs the server to delete the messages from the server after they are retrieved. Use the following format: "DeleteMail=yes/no". ShowMail: If set to "yes", the messages will be displayed in the execution log. Default is "no". Use the format: "ShowMail=yes/no" SaveTo: Saves the data returned by the server to a parameter. Use the format: "SaveTo=ParameterName" SaveAs: Saves the retrieved messages to a file. Use the format: "SaveAs=filename"
LAST | A marker indicating the end of the argument list.

The pop3_retrieve function retrieves messages from the POP3 server. You can specify a range or all of the messages. By default, it deletes the messages from the server after they are retrieved.

This function is for use with global sessions. For multiple sessions, use the pop3_retrieve_ex function, which allows you to specify a session identifier.

## Return Values

If this function succeeds, it returns LR_PASS. Otherwise, it returns LR_FAIL.

## Parameterization

The following argument(s) can be parameterized with standard parameterization: retrieveList, deleteFlag

## Example

In the following example, the pop3_retrieve function retrieves the first five messages.

Copy code

    ...
    // Logon to the POP3 server
    pop3_logon( "Login", "
            URL=pop3://user0004t:my_pwd@techno.merc-int.com",
            LAST );
    // List all messages on the server and get count
    totalMessages = pop3_list("","POP3", LAST );
    /* Output the count (It is also displayed by the pop3_list function) */
    lr_log_message ("There are %d total messages on the server.\r\n\r\n", totalMessages);
    /* Retrieve the 1st and 5th messages on the server without deleting them.
    Create parameters for headers */
    pop3_retrieve("POP3",
        "RetrieveList=1,5",
        "DeleteMail=no",
        "CreateParamForHeader=From,To,Date,Content-Type,Attachment",
        LAST );
    // Delete the first and third messages on the server
    pop3_delete("POP3", "DeleteList=1,3", LAST );
    // Logoff
    pop3_logoff();

Tips to improve your search results... VuGen Function Reference Version 26.1-26.3 Function Reference 26.1-26.3 All View Local Help Center View Online Help Center Version: