Sample code for 30+ languages & platforms
React Native Requires Chilkat v11.0.0+

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 React Native Downloads

React Native
import { Email } from '@chilkat/react-native'

function chilkatExample() {
  const emlPath = 'qa_data/eml/multipart_digest.eml';

  const email = new Email();

  // 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..

  try {
    email.loadEml(emlPath);
  } catch {
    console.log(email.lastErrorText);
    return;
  }

  const numDigests = email.numDigests;
  console.log(`num digests = ${numDigests}`);

  const eDigest = new Email();
  let i = 0;
  while (i < numDigests) {
    email.getDigestEmail(i, eDigest);
    console.log(`${i}:${eDigest.fromAddress}, ${eDigest.subject}`);
    try {
      const m = eDigest.getHeaderField('Message');
      console.log(`    Message = ${m}`);
    } catch {
      // eDigest.getHeaderField() failed; continue anyway.
    }

    i++;
  }
}