Programming Examples

ChilkatHOMEASPVisual BasicVB.NETC#CC++MFCDelphiFoxProJavaPerlPythonRubySQL ServerVBScript

PHP ActiveX Examples

Bounced Mail
Bz2
Certificates/Keys
Charset
CSV
DKIM / DomainKey
Diffie-Hellman
DSA
Email Object
Encryption
FileAccess
FTP
HTML Conversion
HTTP
IMAP
MHT / HTML Email
MIME
NTLM
POP3
RSA
SMTP
Socket
Spider
SSH Key
SSH
SSH Tunnel
SFTP
Tar
Upload
XML
Zip
Amazon S3


 

 

 

 

 

 

 

 

Email with XML Alternative Body

Demonstrates how to create an email with three alternative bodies -- plain-text, HTML, and XML. It is not common to need an XML body, therefore, the Chilkat MIME component is needed to help create the email. Implementing this solution would require licenses to both Chilkat MIME and Chilkat Email (or the Chilkat Bundle, which includes all Chilkat components at a reduced price).

Important: The MIME object is only needed for the 3rd alternative body having the type text/xml. Creating emails with two alternative bodies (HTML and plain-text) is possible using only the Chilkat Email component.

Download Chilkat Email ActiveX

Download 32-bit Chilkat IMAP ActiveX (.msi)

Download All 32-bit Chilkat ActiveX Components (.zip)

Download All 64-bit Chilkat ActiveX Components (.zip)

Download Chilkat MIME ActiveX

<?php

$mime = new COM("Chilkat.Mime");

$success = $mime->UnlockComponent('Anything for 30-day trial.');
if ($success == false) {
    print $mime->lastErrorText() . "\n";
    exit;
}

$mime->NewMultipartAlternative();

$mimeHtml = new COM("Chilkat.Mime");
$mimeHtml->SetBodyFromHtml('<html><body>HTML Body</body></html>');

$mimeText = new COM("Chilkat.Mime");
$mimeText->SetBodyFromPlainText('Plain text body');

$mimeXml = new COM("Chilkat.Mime");
$mimeXml->SetBodyFromXml('<test>XML Body</test>');

$mime->AppendPart($mimeHtml);
$mime->AppendPart($mimeText);
$mime->AppendPart($mimeXml);

$email = new COM("Chilkat.Email2");

$email->SetFromMimeObject($mime);

$email->Subject = 'This is a test';
$email->From = 'support@chilkatsoft.com';
$success = $email->AddTo('Chilkat Sales','sales@chilkatsoft.com');
//  ...
//  You may send the email using the Chilkat MailMan object...
//  ...

$success = $email->SaveEml('email.eml');
if ($success == false) {
    print $email->lastErrorText() . "\n";
    exit;
}

?>

Need a specific example? Send a request to support@chilkatsoft.com

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