Sample code for 30+ languages & platforms
C++

Transition from Imap.FetchBundleAsMime to Imap.FetchSingleBd

Provides instructions for replacing deprecated FetchBundleAsMime method calls with FetchSingleBd.

Chilkat C++ Downloads

C++
#include <CkImap.h>
#include <CkMessageSet.h>
#include <CkStringArray.h>
#include <CkBinData.h>

void ChilkatSample(void)
    {
    bool success = false;

    CkImap imap;

    //  ...
    //  ...

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

    //  ------------------------------------------------------------------------
    //  The FetchBundleAsMime method is deprecated:

    CkStringArray *saObj = imap.FetchBundleAsMime(mset);
    if (imap.get_LastMethodSuccess() == false) {
        std::cout << imap.lastErrorText() << "\r\n";
        return;
    }

    //  ...
    //  ...

    delete saObj;

    //  ------------------------------------------------------------------------
    //  Do the equivalent using FetchSingleBd.

    imap.put_AutoDownloadAttachments(true);

    CkBinData bdMime;
    bool bUid = mset.get_HasUids();
    int numEmails = mset.get_Count();
    int i = 0;
    while (i < numEmails) {
        success = imap.FetchSingleBd(mset.GetId(i),bUid,bdMime);
        //  ...
        //  ...

        i = i + 1;
    }
    }