Sample code for 30+ languages & platforms
DataFlex

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

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Handle hoMht
    String sEmlText
    String sTemp1
    Boolean bTemp1

    Get Create (RefClass(cComChilkatMht)) To hoMht
    If (Not(IsComObjectCreated(hoMht))) Begin
        Send CreateComObject of hoMht
    End

    //  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.
    Get ComGetEML Of hoMht "https://example-code.com/crumb/email.html" To sEmlText
    Get ComLastMethodSuccess Of hoMht To bTemp1
    If (bTemp1 = False) Begin
        Get ComLastErrorText Of hoMht To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Showln sEmlText


End_Procedure