Unicode C
Unicode C
Access Attached Message (Embedded Email)
How to access an email embedded within another email (i.e. an attached message).Chilkat Unicode C Downloads
#include <C_CkEmailW.h>
void ChilkatSample(void)
{
BOOL success;
HCkEmailW email;
int numAttached;
HCkEmailW email2;
success = FALSE;
email = CkEmailW_Create();
// Load an email from a .eml
success = CkEmailW_LoadEml(email,L"embeddedEmail.eml");
if (success == FALSE) {
wprintf(L"%s\n",CkEmailW_lastErrorText(email));
CkEmailW_Dispose(email);
return;
}
// Display how many attached emails are embedded within
// this one:
numAttached = CkEmailW_getNumAttachedMessages(email);
wprintf(L"numAttached = %d\n",numAttached);
// Get the 1st attached message.
email2 = CkEmailW_Create();
success = CkEmailW_GetAttachedEmail(email,0,email2);
if (success == TRUE) {
// Display the subject, From, and a header field...
wprintf(L"%s\n",CkEmailW_subject(email2));
wprintf(L"%s\n",CkEmailW_ck_from(email2));
wprintf(L"%s\n",CkEmailW_getHeaderField(email2,L"X-SOMETHING"));
}
CkEmailW_Dispose(email);
CkEmailW_Dispose(email2);
}