Sample code for 30+ languages & platforms
C

Transition from Email.GetAttachedMessage to Email.GetAttachedEmail

Provides instructions for replacing deprecated GetAttachedMessage method calls with GetAttachedEmail.

Chilkat C Downloads

C
#include <C_CkEmail.h>

void ChilkatSample(void)
    {
    BOOL success;
    HCkEmail email;
    int index;
    HCkEmail emailObj;
    HCkEmail emailOut;

    success = FALSE;

    email = CkEmail_Create();

    //  ...
    //  ...
    index = 0;

    //  ------------------------------------------------------------------------
    //  The GetAttachedMessage method is deprecated:

    emailObj = CkEmail_GetAttachedMessage(email,index);
    if (CkEmail_getLastMethodSuccess(email) == FALSE) {
        printf("%s\n",CkEmail_lastErrorText(email));
        CkEmail_Dispose(email);
        return;
    }

    //  ...
    //  ...

    CkEmail_Dispose(emailObj);

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

    emailOut = CkEmail_Create();
    success = CkEmail_GetAttachedEmail(email,index,emailOut);
    if (success == FALSE) {
        printf("%s\n",CkEmail_lastErrorText(email));
        CkEmail_Dispose(email);
        CkEmail_Dispose(emailOut);
        return;
    }



    CkEmail_Dispose(email);
    CkEmail_Dispose(emailOut);

    }