Sample code for 30+ languages & platforms
Unicode C

Transition from MailMan.GetHeaders to MailMan.FetchRange

Provides instructions for replacing deprecated GetHeaders method calls with FetchRange.

Chilkat Unicode C Downloads

Unicode C
#include <C_CkMailManW.h>
#include <C_CkEmailBundleW.h>

void ChilkatSample(void)
    {
    BOOL success;
    HCkMailManW mailman;
    int numBodyLines;
    int fromIndex;
    int toIndex;
    HCkEmailBundleW bundleObj;
    BOOL keepOnServer;
    BOOL headersOnly;
    HCkEmailBundleW bundleOut;

    success = FALSE;

    mailman = CkMailManW_Create();

    //  ...
    //  ...

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

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

    bundleObj = CkMailManW_GetHeaders(mailman,numBodyLines,fromIndex,toIndex);
    if (CkMailManW_getLastMethodSuccess(mailman) == FALSE) {
        wprintf(L"%s\n",CkMailManW_lastErrorText(mailman));
        CkMailManW_Dispose(mailman);
        return;
    }

    //  ...
    //  ...

    CkEmailBundleW_Dispose(bundleObj);

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

    keepOnServer = TRUE;
    headersOnly = TRUE;

    bundleOut = CkEmailBundleW_Create();
    success = CkMailManW_FetchRange(mailman,keepOnServer,headersOnly,numBodyLines,fromIndex,toIndex,bundleOut);
    if (success == FALSE) {
        wprintf(L"%s\n",CkMailManW_lastErrorText(mailman));
        CkMailManW_Dispose(mailman);
        CkEmailBundleW_Dispose(bundleOut);
        return;
    }



    CkMailManW_Dispose(mailman);
    CkEmailBundleW_Dispose(bundleOut);

    }