Sample code for 30+ languages & platforms
C++

Transition from MailMan.GetHeaders to MailMan.FetchRange

Provides instructions for replacing deprecated GetHeaders method calls with FetchRange.

Chilkat C++ Downloads

C++
#include <CkMailMan.h>
#include <CkEmailBundle.h>

void ChilkatSample(void)
    {
    bool success = false;

    CkMailMan mailman;

    //  ...
    //  ...

    int numBodyLines = 3;
    int fromIndex = 0;
    int toIndex = 9;

    //  ------------------------------------------------------------------------
    //  The GetHeaders method is deprecated:

    CkEmailBundle *bundleObj = mailman.GetHeaders(numBodyLines,fromIndex,toIndex);
    if (mailman.get_LastMethodSuccess() == false) {
        std::cout << mailman.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 keepOnServer = true;
    bool headersOnly = true;

    CkEmailBundle bundleOut;
    success = mailman.FetchRange(keepOnServer,headersOnly,numBodyLines,fromIndex,toIndex,bundleOut);
    if (success == false) {
        std::cout << mailman.lastErrorText() << "\r\n";
        return;
    }
    }