Sample code for 30+ languages & platforms
C

Transition from MailMan.LoadXmlFile to EmailBundle.LoadXml

Provides instructions for replacing deprecated LoadXmlFile method calls with EmailBundle.LoadXml.

Chilkat C Downloads

C
#include <C_CkMailMan.h>
#include <C_CkEmailBundle.h>

void ChilkatSample(void)
    {
    BOOL success;
    HCkMailMan mailman;
    const char *filePath;
    HCkEmailBundle bundleObj;
    HCkEmailBundle bundle;

    success = FALSE;

    mailman = CkMailMan_Create();

    //  ...
    //  ...

    filePath = "c:/example/emailBundle.xml";

    //  ------------------------------------------------------------------------
    //  The LoadXmlFile method is deprecated:

    bundleObj = CkMailMan_LoadXmlFile(mailman,filePath);
    if (CkMailMan_getLastMethodSuccess(mailman) == FALSE) {
        printf("%s\n",CkMailMan_lastErrorText(mailman));
        CkMailMan_Dispose(mailman);
        return;
    }

    //  ...
    //  ...

    CkEmailBundle_Dispose(bundleObj);

    //  ------------------------------------------------------------------------
    //  Do the equivalent using EmailBundle.LoadXml.

    bundle = CkEmailBundle_Create();
    success = CkEmailBundle_LoadXml(bundle,filePath);
    if (success == FALSE) {
        printf("%s\n",CkEmailBundle_lastErrorText(bundle));
        CkMailMan_Dispose(mailman);
        CkEmailBundle_Dispose(bundle);
        return;
    }



    CkMailMan_Dispose(mailman);
    CkEmailBundle_Dispose(bundle);

    }