Sample code for 30+ languages & platforms
PowerBuilder

Create an EML Message from a URL

See more MHT / HTML Email Examples

Demonstrates Mht.GetEML, which creates an EML MIME message from a live web page (or local HTML file) and returns the complete EML text in memory.

Background. The EML output is a MIME email message containing the HTML page and its referenced resources, suitable for sending the page as an HTML email.

Chilkat PowerBuilder Downloads

PowerBuilder
integer li_rc
oleobject loo_Mht
string ls_EmlText

loo_Mht = create oleobject
li_rc = loo_Mht.ConnectToNewObject("Chilkat.Mht")
if li_rc < 0 then
    destroy loo_Mht
    MessageBox("Error","Connecting to COM object failed")
    return
end if

//  Create an EML MIME message from a live web page and return the complete EML text in memory.
//  Referenced resources such as style sheets and images are captured.
ls_EmlText = loo_Mht.GetEML("https://example-code.com/crumb/email.html")
if loo_Mht.LastMethodSuccess = 0 then
    Write-Debug loo_Mht.LastErrorText
    destroy loo_Mht
    return
end if

Write-Debug ls_EmlText


destroy loo_Mht