C
C
Transition from Imap.FetchSingleHeader to Imap.FetchEmail
Provides instructions for replacing deprecated FetchSingleHeader method calls with FetchEmail.Chilkat C Downloads
#include <C_CkImap.h>
#include <C_CkEmail.h>
void ChilkatSample(void)
{
BOOL success;
HCkImap imap;
HCkEmail emailObj;
BOOL headerOnly;
HCkEmail emailOut;
success = FALSE;
imap = CkImap_Create();
// ...
// ...
// ------------------------------------------------------------------------
// The FetchSingleHeader method is deprecated:
emailObj = CkImap_FetchSingleHeader(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 = TRUE;
emailOut = CkEmail_Create();
success = CkImap_FetchEmail(imap,headerOnly,1,FALSE,emailOut);
if (success == FALSE) {
printf("%s\n",CkImap_lastErrorText(imap));
CkImap_Dispose(imap);
CkEmail_Dispose(emailOut);
return;
}
CkImap_Dispose(imap);
CkEmail_Dispose(emailOut);
}