Share this page

# pop3_retrieve_ex

Post Office Protocol Vuser Functions (POP3)

Retrieves messages from the POP3 server for a specific session.

    long pop3_retrieve_ex( POP3 *pppop3, char *transaction, char *retrieveList,
    char *deleteFlag, [<Options>,] LAST );

pppop3 | A session identifier.
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 range of messages to retrieve. Use the one of the following formats: `"RetrieveList=`begin`-`end`", "RetrieveList=`Msga,Msgb,..,Msgn`",` or`"RetrieveList=ALL"`
deleteFlag | If this flag is set to true (default), it instructs the server to delete the messages from the server after they are retrieved. Use the following format: "DeleteMail=yes/no"
<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.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_ex 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 multiple sessions. For global sessions, use the pop3_retrieve function, which leaves out the 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_ex function retrieves the first and third messages and saves the headers to parameters.

    ...

    // Logon to the POP3 server

    pop3_logon_ex(&pppop3, "Login", "
            URL=pop3://user0004t:my_pwd@techno.merc-int.com",
            LAST );

    /* List all messages on the server and get the number of messages*/

    totalMessages = pop3_list_ex(&pppop3, "POP3", LAST );

    /* Display the number of messages (It is also displayed by the pop3_list_ex function) */

    lr_log_message("There are %d total messages on the server.\r\n\r\n", totalMessages);

    /* Retrieve the first and third messages on the server without deleting them.

        Save the headers to parameters */

    pop3_retrieve_ex(&pppop3, "RetrieveMail",
        "RetrieveList=1,3",
        "DeleteMail=No",
        "SaveAs=c:\\temp\\debug.txt",
        "SaveTo=msgBody",
        "CreateParamForHeader=From,To,Date,Content-Type,Attachment",
        LAST );

    // Delete the first and third messages on the server

    pop3_delete_ex(&pppop3, "POP3", "DeleteList=1:3", LAST );

    // Logoff

    pop3_logoff_ex(&pppop3);
    return 0;

## Execution Log

    Example: Debug message:Recieving Email #1
    Notify: Saving Parameter "pop3_header_From_1 = "Product User" <qatest@aqwa.abc.co.il>"
    Notify: Saving Parameter "pop3_header_To_1 = <qatest1@aqwa.abc.co.il>"
    Notify: Saving Parameter "pop3_header_Date_1 = Sun, 08 Feb 2004 13:47:09 +-200"
    Notify: Saving Parameter "pop3_header_Subject_1 = "
    Notify: Saving Parameter "pop3_header_Content-Type_1 = "
    Notify: Saving Parameter "pop3_header_Attachment_1 = "
    Debug message:Recieving Email #3
    Notify: Saving Parameter "pop3_header_From_3 = "Product User" <qatest@aqwa.abc.co.il>"
    Notify: Saving Parameter "pop3_header_To_3 = <qatest1@aqwa.abc.co.il>"
    Notify: Saving Parameter "pop3_header_Date_3 = Sun, 08 Feb 2004 13:47:10 +-200"
    Notify: Saving Parameter "pop3_header_Subject_3 = Attached file is : "outfile.txt""
    Notify: Saving Parameter "pop3_header_Content-Type_3 = multipart/mixed;"
    Notify: Saving Parameter "pop3_header_Attachment_3 = outfile.txt"

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