Sample code for 30+ languages & platforms
Node.js

Transition from MailMan.LoadXmlEmail to Email.SetFromXmlText

Provides instructions for replacing deprecated LoadXmlEmail method calls with Email.SetFromXmlText.

Chilkat Node.js Downloads

Node.js
NODEJS_PRELUDE

function chilkatExample() {

    var success = false;

    var mailman = new chilkat.MailMan();

    //  ...
    //  ...

    var xmlFilePath = "c:/test/example.xml";

    //  ------------------------------------------------------------------------
    //  The LoadXmlEmail method is deprecated:

    // emailObj: Email
    var emailObj = mailman.LoadXmlEmail(xmlFilePath);
    if (mailman.LastMethodSuccess == false) {
        console.log(mailman.LastErrorText);
        return;
    }

    //  ...
    //  ...

    //  ------------------------------------------------------------------------
    //  Do the equivalent using Email.SetFromXmlText.

    var sb = new chilkat.StringBuilder();
    success = sb.LoadFile(xmlFilePath,"utf-8");
    if (success == false) {
        console.log(sb.LastErrorText);
        return;
    }

    var email = new chilkat.Email();
    success = email.SetFromXmlText(sb.GetAsString());
    if (success == false) {
        console.log(email.LastErrorText);
        return;
    }


}

chilkatExample();