Sample code for 30+ languages & platforms
C++

Transition from Imap.FetchBundle to Imap.FetchMsgSet

Provides instructions for replacing deprecated FetchBundle method calls with FetchMsgSet.

Chilkat C++ Downloads

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

void ChilkatSample(void)
    {
    bool success = false;

    CkImap imap;

    //  ...
    //  ...

    CkMessageSet mset;
    success = imap.QueryMbx("FROM joe@example.com",true,mset);
    //  ...
    //  ...

    //  ------------------------------------------------------------------------
    //  The FetchBundle method is deprecated:

    CkEmailBundle *bundleObj = imap.FetchBundle(mset);
    if (imap.get_LastMethodSuccess() == false) {
        std::cout << imap.lastErrorText() << "\r\n";
        return;
    }

    //  ...
    //  ...

    delete bundleObj;

    //  ------------------------------------------------------------------------
    //  Do the equivalent using FetchMsgSet.
    //  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.FetchMsgSet(headersOnly,mset,bundleOut);
    if (success == false) {
        std::cout << imap.lastErrorText() << "\r\n";
        return;
    }
    }