Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(DataFlex) Attach Email as message/rfc822 sub-part to an EmailDemonstrates how to add attach a message/rfc822 email to another email.
Use ChilkatAx-win32.pkg Procedure Test Boolean iSuccess Variant hoEmlBytes Handle hoFac Handle hoEmail Handle hoEmailToBeAttached 2 Handle hoEmail2 Variant hoEmlBytes2 String sTemp1 // In this example, we'll attach an email loaded from a .eml file to a new email. Get Create (RefClass(cComCkFileAccess)) To hoFac If (Not(IsComObjectCreated(hoFac))) Begin Send CreateComObject of hoFac End Get ComReadEntireFile Of hoFac "qa_data/eml/simple.eml" To hoEmlBytes Get Create (RefClass(cComChilkatEmail)) To hoEmail If (Not(IsComObjectCreated(hoEmail))) Begin Send CreateComObject of hoEmail End Set ComSubject Of hoEmail To "This is a test email with an attached email." Set ComBody Of hoEmail To "Test with attached email." Get ComAddTo Of hoEmail "Joe" "joe@example.com" To iSuccess Set ComFrom Of hoEmail To "mary@example.com" Get ComAttachMessage Of hoEmail vEmlBytes To iSuccess Get ComGetMime Of hoEmail To sTemp1 Showln sTemp1 // ---------------------------------------------------------------------- // Alternatively, we could do this: Get Create (RefClass(cComChilkatEmail)) To hoEmailToBeAttached If (Not(IsComObjectCreated(hoEmailToBeAttached))) Begin Send CreateComObject of hoEmailToBeAttached End Get ComLoadEml Of hoEmailToBeAttached "qa_data/eml/simple.eml" To iSuccess Get Create (RefClass(cComChilkatEmail)) To hoEmail2 If (Not(IsComObjectCreated(hoEmail2))) Begin Send CreateComObject of hoEmail2 End Set ComSubject Of hoEmail2 To "This is a test email with an attached email." Set ComBody Of hoEmail2 To "Test with attached email." Get ComAddTo Of hoEmail2 "Joe" "joe@example.com" To iSuccess Set ComFrom Of hoEmail2 To "mary@example.com" Get ComGetMimeBinary Of hoEmailToBeAttached To hoEmlBytes2 Get ComAttachMessage Of hoEmail2 vEmlBytes2 To iSuccess Showln "----" Get ComGetMime Of hoEmail2 To sTemp1 Showln sTemp1 End_Procedure |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.