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

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 CkPerl Downloads

CkPerl
use chilkat();

$success = 0;

#  Assumes Chilkat is unlocked. See Global Unlock Sample.

$email = chilkat::CkEmail->new();
$success = $email->LoadEml("inline-image.eml");
if ($success != 1) {
    print $email->lastErrorText() . "\r\n";
    exit;
}

if ($email->HasHtmlBody() != 1) {
    print "This message has no HTML body." . "\r\n";
    exit;
}

$success = $email->UnpackHtml("workshop-preview","index.html","images");
if ($success != 1) {
    print $email->lastErrorText() . "\r\n";
    exit;
}

print "Saved workshop-preview/index.html and its related files." . "\r\n";