Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

DataFlex Examples

Web API Categories

ASN.1
AWS KMS
AWS Misc
Amazon EC2
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Key Vault
Azure Service Bus
Azure Table Service
Base64
Bounced Email
Box
CAdES
CSR
CSV
Certificates
Cloud Signature CSC
Code Signing
Compression
DKIM / DomainKey
DNS
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
EBICS
ECC
Ed25519
Email Object
Encryption
FTP
FileAccess
Firebase
GMail REST API
GMail SMTP/IMAP/POP
Geolocation
Google APIs
Google Calendar
Google Cloud SQL
Google Cloud Storage
Google Drive
Google Photos
Google Sheets
Google Tasks
Gzip
HTML-to-XML/Text
HTTP

HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)
Java KeyStore (JKS)
MHT / HTML Email
MIME
MS Storage Providers
Microsoft Graph
Misc
NTLM
OAuth1
OAuth2
OIDC
Office365
OneDrive
OpenSSL
Outlook
Outlook Calendar
Outlook Contact
PDF Signatures
PEM
PFX/P12
PKCS11
POP3
PRNG
REST
REST Misc
RSA
SCP
SCard
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
ScMinidriver
SharePoint
SharePoint Online
Signing in the Cloud
Socket/SSL/TLS
Spider
Stream
Tar Archive
ULID/UUID
Upload
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Zip
curl
uncategorized

 

 

 

(DataFlex) Attach Email as message/rfc822 sub-part to an Email

Demonstrates how to add attach a message/rfc822 email to another email.

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

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.