Sample code for 30+ languages & platforms
Unicode C++

Retrieve UIDL's from POP3 Server

Retrieve a list of UIDLs from a POP3 server. UIDLs are unique identifiers, 1 to 70 characters long, composed of characters ranging from 0x21 to 0x7E. These identifiers uniquely distinguish messages within a mailbox and remain consistent across sessions.

Chilkat Unicode C++ Downloads

Unicode C++
#include <CkMailManW.h>
#include <CkStringTableW.h>
#include <CkEmailW.h>

void ChilkatSample(void)
    {
    bool success = false;

    // This example requires the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    CkMailManW mailman;

    mailman.put_MailHost(L"pop.example.com");

    mailman.put_PopUsername(L"myLogin");
    mailman.put_PopPassword(L"myPassword");

    mailman.put_MailPort(995);
    mailman.put_PopSsl(true);

    CkStringTableW stUidls;
    success = mailman.FetchUidls(stUidls);
    if (success == false) {
        wprintf(L"%s\n",mailman.lastErrorText());
        return;
    }

    // Download each email by UIDL.
    CkEmailW email;

    int count = stUidls.get_Count();
    int i = 0;
    while (i < count) {
        // Download the full email.
        const wchar_t *uidl = stUidls.stringAt(i);
        success = mailman.FetchByUidl(uidl,false,0,email);
        if (success == false) {
            wprintf(L"%s\n",mailman.lastErrorText());
            return;
        }

        wprintf(L"%d\n",i);
        wprintf(L"UIDL: %s\n",uidl);
        wprintf(L"From: %s\n",email.ck_from());
        wprintf(L"Subject: %s\n",email.subject());

        i = i + 1;
    }

    mailman.Pop3EndSession();
    }