Sample code for 30+ languages & platforms
C

Transition from Imap.FetchSingle to Imap.FetchEmail

Provides instructions for replacing deprecated FetchSingle method calls with FetchEmail.

Chilkat C Downloads

C
#include <C_CkImap.h>
#include <C_CkEmail.h>

void ChilkatSample(void)
    {
    BOOL success;
    HCkImap imap;
    HCkEmail emailObj;
    BOOL headerOnly;
    HCkEmail email;

    success = FALSE;

    imap = CkImap_Create();

    //  ...
    //  ...

    //  ------------------------------------------------------------------------
    //  The FetchSingle method is deprecated:

    emailObj = CkImap_FetchSingle(imap,1,FALSE);
    if (CkImap_getLastMethodSuccess(imap) == FALSE) {
        printf("%s\n",CkImap_lastErrorText(imap));
        CkImap_Dispose(imap);
        return;
    }

    //  ...
    //  ...

    CkEmail_Dispose(emailObj);

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

    headerOnly = FALSE;

    email = CkEmail_Create();
    success = CkImap_FetchEmail(imap,headerOnly,1,FALSE,email);
    if (success == FALSE) {
        printf("%s\n",CkImap_lastErrorText(imap));
        CkImap_Dispose(imap);
        CkEmail_Dispose(email);
        return;
    }



    CkImap_Dispose(imap);
    CkEmail_Dispose(email);

    }