Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Mono C#.NET Core C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicCkPythonChilkat2-PythonRubySQL ServerSwift 2Swift 3/4TclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.jsExcelGo

Xojo Plugin Examples

Web API Categories

ASN.1
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Service Bus
Base64
Bounced Email
Box
CAdES
CSR
CSV
Certificates
Compression
DKIM / DomainKey
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
ECC
Email Object
Encryption
FTP
FileAccess
Firebase
GMail REST API
Geolocation
Google APIs
Google Calendar
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
Microsoft Graph
NTLM
OAuth1
OAuth2
OneDrive
OpenSSL
Outlook
PEM
PFX/P12
POP3
PRNG
REST
REST Misc
RSA Encryption
SCP
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
SharePoint
Socket/SSL/TLS
Spider
Stream
Tar Archive
Upload
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Zip
curl

 

 

 

(Xojo Plugin) Create AMP for Email

Demonstrates how to create an email that has the AMP for Email Format.

See AMP for Email specification for more information.

Chilkat Xojo Plugin Download

Xojo Plugin for Windows, Linux, Mac OS X, and ARM

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

Dim email As New Chilkat.Email
Dim success As Boolean

email.Subject = "Sample AMP for Email"
email.From = "mary@example.com"
success = email.AddTo("Joe","joe@example.com")

// Create the following AMP for Email HTML

// <!doctype html>
// <html amp4email>
// <head>
//   <meta charset="utf-8">
//   <style amp4email-boilerplate>body{visibility:hidden}</style>
//   <script async src="https://cdn.ampproject.org/v0.js"></script>
// </head>
// <body>
// Hello, world.
// </body>
// </html>

Dim sbAmp4Html As New Chilkat.StringBuilder
success = sbAmp4Html.Append("<!doctype html>")
success = sbAmp4Html.Append("<html amp4email>")
success = sbAmp4Html.Append("<head>")
success = sbAmp4Html.Append("<meta charset=""utf-8"">")
success = sbAmp4Html.Append("<style amp4email-boilerplate>body{visibility:hidden}</style>")
success = sbAmp4Html.Append("<script async src=""https://cdn.ampproject.org/v0.js""></script>")
success = sbAmp4Html.Append("</head>")
success = sbAmp4Html.Append("<body>")
success = sbAmp4Html.Append("Hello, world.")
success = sbAmp4Html.Append("</body>")
success = sbAmp4Html.Append("</html>")

// We want to build a multipart/alternative email, where the 1st alternative body
// is text/plain, the 2nd is text/x-amp-html, and the last is text/html.
// (Some email clients will only render the last MIME part, so we recommend placing the text/x-amp-html MIME part before the text/html MIME part.)

// First create a plain-text email body:
success = email.AddPlainTextAlternativeBody("Hello World in plain text!")

// Now add the text/x-amp-html.
email.SetTextBody sbAmp4Html.GetAsString(),"text/x-amp-html"

// Now add an HTML body..
success = email.AddHtmlAlternativeBody("<span>Hello World in HTML!</span>")

// See what we have:
System.DebugLog(email.GetMime())

// This is the result:
// (Note: Any CKX- headers produced by Chilkat are automatically removed prior to sending.)

// MIME-Version: 1.0
// Date: Thu, 30 May 2019 09:37:56 -0500
// Message-ID: <923A689FF657170A9F662B4CE87978AB1EBD4DBD@CHILKATSLICE>
// Content-Type: multipart/alternative;
//  boundary="------------040205090807060906020803"
// X-Priority: 3 (Normal)
// Subject: Sample AMP for Email
// From: mary@example.com
// CKX-Bounce-Address: mary@example.com
// To: Joe <joe@example.com>
// 
// --------------040205090807060906020803
// Content-Transfer-Encoding: 7bit
// Content-Type: text/plain; charset=us-ascii; format=flowed
// 
// Hello World in plain text!
// --------------040205090807060906020803
// Content-Transfer-Encoding: 7bit
// Content-Type: text/x-amp-html; charset=us-ascii
// 
// <!doctype html><html amp4email><head><meta charset="utf-8"><style amp4email-boilerplate>body{visibility:hidden}</style><script async src="https://cdn.ampproject.org/v0.js"></script></head><body>Hello, world.</body></html>
// --------------040205090807060906020803
// Content-Transfer-Encoding: 7bit
// Content-Type: text/html; charset=us-ascii
// 
// <span>Hello World in HTML!</span>
// 
// --------------040205090807060906020803--

 

© 2000-2019 Chilkat Software, Inc. All Rights Reserved.