C# Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CMFCDelphiFoxProJavaPerl
PHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

C# Examples

Bounced Mail
Bz2
Character Encoding
CSV
DKIM / DomainKey
Digital Certificates
Digital Signatures
Email
Email Object
FTP
HTML Conversion
HTTP
IMAP
Encryption
MHT / HTML Email
MIME
POP3
RSA
S/MIME
SMTP
Socket
Spider
SSH
SSH Tunnel
SSH Key
SFTP
Tar Archive
Upload
XML
XMP
Zip Compression


More Examples...
Amazon S3
NTLM
FileAccess
RSS
Atom
String
Byte Array
Self-Extractor
Service
PPMD
Deflate
DH Key Exchange
DSA
Bzip2
LZW

 

 

 

 

 

 

Add a file/image encoded as a Base64 string to an email

Download: Chilkat .NET Assemblies

Demonstrates how to add a file/image encoded as a Base64 string to an email.

            Chilkat.MailMan mailman = new Chilkat.MailMan();
            mailman.UnlockComponent("Anything for 30-day trial");

            // First, load the image from a file and convert it to base64.

            // The Crypt2.Encode/Decode methods are always unlocked and
            // do not require a license.  The Crypt2.ReadFile/WriteFile
            // methods are also free.
            Chilkat.Crypt2 crypt = new Chilkat.Crypt2();
            byte[] gifImage = crypt.ReadFile("dude.gif");
            string gifBase64 = crypt.Encode(gifImage, "base64");

            // This is our starting point.  We have an image encoded as a
            // base64 string and we want to add it as an attachment to the email.
            Chilkat.Email email = new Chilkat.Email();
            email.Subject = "Test";
            email.From = "support@chilkatsoft.com";
            email.AddTo("Matt", "matt@chilkatsoft.com");
            email.Body = "Email with image attachment added from base64 string.";

            // Use the Crypt2.Decode method to decode...
            email.AddDataAttachment("dude.gif", crypt.Decode(gifBase64,"base64"));

            email.SaveEml("test.eml");

Important: The download for this example does not contain the ChilkatDotNet.dll which
must be downloaded and installed separately at http://www.chilkatsoft.com/downloads.asp.
Once installed, add a reference to the DLL in the project by following the instructions at
http://www.example-code.com/vbdotnet/step2.asp

 

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

Email Component · XML Parser