CkJava Requires Chilkat v11.0.0+
CkJava
Export HTML and related files into a directory
See more Email Object Examples
Choose a separate directory for each message. UnpackHtml writes the HTML file, exports its related resources, and rewrites links to their local paths. This is useful when images should remain separate files.
Chilkat CkJava Downloads
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;
// Assumes Chilkat is unlocked. See Global Unlock Sample.
CkEmail email = new CkEmail();
success = email.LoadEml("inline-image.eml");
if (success != true) {
System.out.println(email.lastErrorText());
return;
}
if (email.HasHtmlBody() != true) {
System.out.println("This message has no HTML body.");
return;
}
success = email.UnpackHtml("workshop-preview","index.html","images");
if (success != true) {
System.out.println(email.lastErrorText());
return;
}
System.out.println("Saved workshop-preview/index.html and its related files.");
}
}