Sample code for 30+ languages & platforms
C

Transition from MailMan.FetchEmail to MailMan.FetchByUidl

Provides instructions for replacing deprecated FetchEmail method calls with FetchByUidl.

Chilkat C Downloads

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

void ChilkatSample(void)
    {
    BOOL success;
    HCkMailMan mailman;
    const char *uidl;
    HCkEmail emailObj;
    BOOL headerOnly;
    int numBodyLines;
    HCkEmail emailOut;

    success = FALSE;

    mailman = CkMailMan_Create();

    //  ...
    //  ...

    uidl = "123";

    //  ------------------------------------------------------------------------
    //  The FetchEmail method is deprecated:

    emailObj = CkMailMan_FetchEmail(mailman,uidl);
    if (CkMailMan_getLastMethodSuccess(mailman) == FALSE) {
        printf("%s\n",CkMailMan_lastErrorText(mailman));
        CkMailMan_Dispose(mailman);
        return;
    }

    //  ...
    //  ...

    CkEmail_Dispose(emailObj);

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

    headerOnly = FALSE;
    //  Irrelevant because we are not downloading headers-only.
    numBodyLines = 0;

    emailOut = CkEmail_Create();
    success = CkMailMan_FetchByUidl(mailman,uidl,headerOnly,numBodyLines,emailOut);
    if (success == FALSE) {
        printf("%s\n",CkMailMan_lastErrorText(mailman));
        CkMailMan_Dispose(mailman);
        CkEmail_Dispose(emailOut);
        return;
    }



    CkMailMan_Dispose(mailman);
    CkEmail_Dispose(emailOut);

    }