Sample code for 30+ languages & platforms
Java

Load MIME Object from Email Object

See more Email Object Examples

Demonstrates how to load a Chilkat Mime object from a Chilkat Email object. (Copies the email into a Mime object.)

Chilkat Java Downloads

Java
import com.chilkatsoft.*;

public class ChilkatExample {

  static {
    try {
        System.loadLibrary("chilkat");
    } catch (UnsatisfiedLinkError e) {
      System.err.println("Native code library failed to load.\n" + e);
      System.exit(1);
    }
  }

  public static void main(String argv[])
  {
    boolean success = false;

    CkEmail email = new CkEmail();
    success = email.LoadEml("qa_data/eml/sample.eml");

    // Write the full MIME of the email to a StringBuilder.
    CkStringBuilder sbMime = new CkStringBuilder();
    email.GetMimeSb(sbMime);

    // Load the MIME object from the StringBuilder
    CkMime mime = new CkMime();
    success = mime.LoadMimeSb(sbMime);

    System.out.println(mime.getMime());
  }
}