Sample code for 30+ languages & platforms
C++

Transition from Imap.FetchChunk to Imap.FetchRange

Provides instructions for replacing deprecated FetchChunk method calls with FetchRange.

Chilkat C++ Downloads

C++
#include <CkImap.h>
#include <CkMessageSet.h>
#include <CkEmailBundle.h>

void ChilkatSample(void)
    {
    bool success = false;

    CkImap imap;

    //  ...
    //  ...

    int startSeqNum = 1;
    int count = 5;

    CkMessageSet failedSet;
    CkMessageSet fetchedSet;

    //  ------------------------------------------------------------------------
    //  The FetchChunk method is deprecated:

    CkEmailBundle *bundleObj = imap.FetchChunk(startSeqNum,count,failedSet,fetchedSet);
    if (imap.get_LastMethodSuccess() == false) {
        std::cout << imap.lastErrorText() << "\r\n";
        return;
    }

    //  ...
    //  ...

    delete bundleObj;

    //  ------------------------------------------------------------------------
    //  Do the equivalent using FetchRange.
    //  Your application creates a new, empty EmailBundle object which is passed 
    //  in the last argument and filled upon success.

    bool headersOnly = false;

    CkEmailBundle bundleOut;
    success = imap.FetchRange(headersOnly,startSeqNum,count,bundleOut);
    if (success == false) {
        std::cout << imap.lastErrorText() << "\r\n";
        return;
    }
    }