Sample code for 30+ languages & platforms
Node.js

Transition from MailMan.GetHeaders to MailMan.FetchRange

Provides instructions for replacing deprecated GetHeaders method calls with FetchRange.

Chilkat Node.js Downloads

Node.js
NODEJS_PRELUDE

function chilkatExample() {

    var success = false;

    var mailman = new chilkat.MailMan();

    //  ...
    //  ...

    var numBodyLines = 3;
    var fromIndex = 0;
    var toIndex = 9;

    //  ------------------------------------------------------------------------
    //  The GetHeaders method is deprecated:

    // bundleObj: EmailBundle
    var bundleObj = mailman.GetHeaders(numBodyLines,fromIndex,toIndex);
    if (mailman.LastMethodSuccess == false) {
        console.log(mailman.LastErrorText);
        return;
    }

    //  ...
    //  ...

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

    var keepOnServer = true;
    var headersOnly = true;

    var bundleOut = new chilkat.EmailBundle();
    success = mailman.FetchRange(keepOnServer,headersOnly,numBodyLines,fromIndex,toIndex,bundleOut);
    if (success == false) {
        console.log(mailman.LastErrorText);
        return;
    }


}

chilkatExample();