(Unicode C++) Access Attached Message (Embedded Email)
How to access an email embedded within another email (i.e. an attached message).
#include <CkEmailW.h>
void ChilkatSample(void)
{
CkEmailW email;
// Load an email from a .eml
bool success = email.LoadEml(L"embeddedEmail.eml");
if (success != true) {
wprintf(L"%s\n",email.lastErrorText());
return;
}
// Display how many attached emails are embedded within
// this one:
int numAttached = email.get_NumAttachedMessages();
wprintf(L"numAttached = %d\n",numAttached);
// Get the 1st attached message.
CkEmailW *email2 = 0;
email2 = email.GetAttachedMessage(0);
if (email.get_LastMethodSuccess() == true) {
// Display the subject, From, and a header field...
wprintf(L"%s\n",email2->subject());
wprintf(L"%s\n",email2->ck_from());
wprintf(L"%s\n",email2->getHeaderField(L"X-SOMETHING"));
}
}
|