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) Add File Attachments to an EmailDemonstrates how to add one or more file attachments to an email.
Use ChilkatAx-win32.pkg Procedure Test Handle hoEmail Boolean iSuccess String sContentType String sTemp1 Boolean bTemp1 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" Set ComBody Of hoEmail To "This is a test" Set ComFrom Of hoEmail To "support@chilkatsoft.com" Get ComAddTo Of hoEmail "Chilkat Admin" "admin@chilkatsoft.com" To iSuccess // To add file attachments to an email, call AddFileAttachment // once for each file to be attached. The method returns // the content-type of the attachment if successful, otherwise // returns cknull Get ComAddFileAttachment Of hoEmail "something.pdf" To sContentType Get ComLastMethodSuccess Of hoEmail To bTemp1 If (bTemp1 <> True) Begin Get ComLastErrorText Of hoEmail To sTemp1 Showln sTemp1 Procedure_Return End Get ComAddFileAttachment Of hoEmail "something.xml" To sContentType Get ComLastMethodSuccess Of hoEmail To bTemp1 If (bTemp1 <> True) Begin Get ComLastErrorText Of hoEmail To sTemp1 Showln sTemp1 Procedure_Return End Get ComAddFileAttachment Of hoEmail "something.zip" To sContentType Get ComLastMethodSuccess Of hoEmail To bTemp1 If (bTemp1 <> True) Begin Get ComLastErrorText Of hoEmail To sTemp1 Showln sTemp1 Procedure_Return End Get ComSaveEml Of hoEmail "email.eml" To iSuccess If (iSuccess = False) Begin Get ComLastErrorText Of hoEmail To sTemp1 Showln sTemp1 Procedure_Return End Showln "Saved EML!" End_Procedure |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.