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

Transition from Imap.FetchBundleAsMime to Imap.FetchSingleBd

Provides instructions for replacing deprecated FetchBundleAsMime method calls with FetchSingleBd.

Chilkat Unicode C++ Downloads

Unicode C++
#include <CkImapW.h>
#include <CkMessageSetW.h>
#include <CkStringArrayW.h>
#include <CkBinDataW.h>

void ChilkatSample(void)
    {
    bool success = false;

    CkImapW imap;

    //  ...
    //  ...

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

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

    CkStringArrayW *saObj = imap.FetchBundleAsMime(mset);
    if (imap.get_LastMethodSuccess() == false) {
        wprintf(L"%s\n",imap.lastErrorText());
        return;
    }

    //  ...
    //  ...

    delete saObj;

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

    imap.put_AutoDownloadAttachments(true);

    CkBinDataW 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;
    }
    }