Unicode C
Unicode C
Parsing a Multipart/Digest Email
See more Email Object Examples
This example demonstrates how to parse a multipart/digest email. An email parsed by this sample could have a MIME structure as follows:
multipart/mixed
text/plain
text/plain
multipart/digest
message/rfc822
message/rfc822
message/rfc822
message/rfc822
message/rfc822
message/rfc822
message/rfc822
message/rfc822
message/rfc822
message/rfc822
message/rfc822
message/rfc822
message/rfc822
message/rfc822
message/rfc822
message/rfc822
message/rfc822
message/rfc822
message/rfc822
message/rfc822
message/rfc822
text/plain
Chilkat Unicode C Downloads
#include <C_CkEmailW.h>
void ChilkatSample(void)
{
BOOL success;
const wchar_t *emlPath;
HCkEmailW email;
int numDigests;
HCkEmailW eDigest;
int i;
const wchar_t *m;
success = FALSE;
emlPath = L"qa_data/eml/multipart_digest.eml";
email = CkEmailW_Create();
// For this example, we'll load the email from a .eml.
// The email could alternatively be loaded as a result of downloading from an IMAP or POP3 server..
success = CkEmailW_LoadEml(email,emlPath);
if (success == FALSE) {
wprintf(L"%s\n",CkEmailW_lastErrorText(email));
CkEmailW_Dispose(email);
return;
}
numDigests = CkEmailW_getNumDigests(email);
wprintf(L"num digests = %d\n",numDigests);
eDigest = CkEmailW_Create();
i = 0;
while (i < numDigests) {
CkEmailW_GetDigestEmail(email,i,eDigest);
wprintf(L"%d:%s, %s\n",i,CkEmailW_fromAddress(eDigest),CkEmailW_subject(eDigest));
m = CkEmailW_getHeaderField(eDigest,L"Message");
if (CkEmailW_getLastMethodSuccess(eDigest) == TRUE) {
wprintf(L" Message = %s\n",m);
}
i = i + 1;
}
CkEmailW_Dispose(email);
CkEmailW_Dispose(eDigest);
}