Sample code for 30+ languages & platforms
Unicode C

Transition from MailMan.CopyMail to MailMan.FetchAll

Provides instructions for replacing deprecated CopyMail method calls with FetchAll.

Chilkat Unicode C Downloads

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

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

    success = FALSE;

    mailman = CkMailManW_Create();

    //  ...
    //  ...

    //  ------------------------------------------------------------------------
    //  The CopyMail method is deprecated:

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

    //  ...
    //  ...

    CkEmailBundleW_Dispose(bundleObj);

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

    keepOnServer = TRUE;
    headersOnly = FALSE;
    //  Irrelevent because we are not downloading headers-only.
    numBodyLines = 0;

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



    CkMailManW_Dispose(mailman);
    CkEmailBundleW_Dispose(bundleOut);

    }