Share this page

# Example: pop3_retrieve_ex

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 25.1-25.3 Function Reference 25.1-25.3 All View Local Help Center View Online Help Center Version: