Sample code for 30+ languages & platforms
Node.js

Transition from Imap.FetchBundleAsMime to Imap.FetchSingleBd

Provides instructions for replacing deprecated FetchBundleAsMime method calls with FetchSingleBd.

Chilkat Node.js Downloads

Node.js
NODEJS_PRELUDE

function chilkatExample() {

    var success = false;

    var imap = new chilkat.Imap();

    //  ...
    //  ...

    var mset = new chilkat.MessageSet();
    success = imap.QueryMbx("FROM joe@example.com",true,mset);
    //  ...
    //  ...

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

    // saObj: StringArray
    var saObj = imap.FetchBundleAsMime(mset);
    if (imap.LastMethodSuccess == false) {
        console.log(imap.LastErrorText);
        return;
    }

    //  ...
    //  ...

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

    imap.AutoDownloadAttachments = true;

    var bdMime = new chilkat.BinData();
    var bUid = mset.HasUids;
    var numEmails = mset.Count;
    var i = 0;
    while (i < numEmails) {
        success = imap.FetchSingleBd(mset.GetId(i),bUid,bdMime);
        //  ...
        //  ...

        i = i+1;
    }


}

chilkatExample();