Sample code for 30+ languages & platforms
Node.js

Transition from Imap.CheckForNewEmail to Imap.QueryMbx

Provides instructions for replacing deprecated CheckForNewEmail method calls with QueryMbx.

Chilkat Node.js Downloads

Node.js
NODEJS_PRELUDE

function chilkatExample() {

    var success = false;

    var imap = new chilkat.Imap();

    //  ...
    //  ...

    //  ------------------------------------------------------------------------
    //  The CheckForNewEmail method is deprecated:

    // msgSetObj: MessageSet
    var msgSetObj = imap.CheckForNewEmail();
    if (imap.LastMethodSuccess == false) {
        console.log(imap.LastErrorText);
        return;
    }

    //  ...
    //  ...

    //  ------------------------------------------------------------------------
    //  Do the equivalent using QueryMbx.
    //  Your application creates a new, empty MessageSet object which is passed 
    //  in the last argument and filled upon success.

    var criteria = "new-email";
    var bUid = true;

    var msgSet = new chilkat.MessageSet();
    success = imap.QueryMbx(criteria,bUid,msgSet);
    if (success == false) {
        console.log(imap.LastErrorText);
        return;
    }


}

chilkatExample();