Sample code for 30+ languages & platforms
Unicode C++ Requires Chilkat v11.0.0+

Inspect the MIME structure and contents of an EML file

See more Email Object Examples

Open the complete EML in Mime for a tree view and in Email for application-level collections. An HTML logo, downloadable file, attached message, and delivery report are counted separately. Try the complex workshop draft.

Chilkat Unicode C++ Downloads

Unicode C++
#include <CkEmailW.h>
#include <CkMimeW.h>

void ChilkatSample(void)
    {
    bool success = false;

    //  Assumes Chilkat is unlocked. See Global Unlock Sample.

    CkEmailW email;
    success = email.LoadEml(L"workshop.eml");
    if (success != true) {
        wprintf(L"%s\n",email.lastErrorText());
        return;
    }

    CkMimeW mime;
    success = mime.LoadMimeFile(L"workshop.eml");
    if (success != true) {
        wprintf(L"%s\n",mime.lastErrorText());
        return;
    }

    wprintf(L"%s\n",mime.getStructure(L"text"));
    wprintf(L"Subject: %s\n",email.subject());
    wprintf(L"Files: %d  Related items: %d\n",email.get_NumAttachments(),email.get_NumRelatedItems());
    wprintf(L"Attached messages: %d  Reports: %d\n",email.get_NumAttachedMessages(),email.get_NumReports());
    int i = 0;
    while ((i < email.get_NumAttachments())) {
        wprintf(L"%s  %s  %d bytes\n",email.getAttachmentFilename(i),email.getAttachmentContentType(i),email.GetAttachmentSize(i));
        i = i + 1;
    }

    i = 0;
    while ((i < email.get_NumRelatedItems())) {
        wprintf(L"Related: %s  %s\n",email.getRelatedFilename(i),email.getRelatedContentType(i));
        i = i + 1;
    }
    }