Chilkat HOME Android™ ASP Visual Basic VB.NET C# iOS (IPhone) Objective-C C++ C Unicode C++ Unicode C MFC Delphi DLL Delphi ActiveX FoxPro Java Perl PHP Extension PHP ActiveX Python PowerShell Ruby SQL Server VBScript
Send HTML Email with Embedded ImageDownload: Chilkat .NET Assemblies C# source code sample showing how to send an HTML email with images embedded within the HTML. bool success = false; // Create a mailman object for sending email. Chilkat.MailMan mailman = new Chilkat.MailMan(); // Any string argument automatically begins the 30-day trial. mailman.UnlockComponent("30-day trial"); // Set the SMTP server. mailman.SmtpHost = "smtp.earthlink.net"; // Create an email object Chilkat.Email email = new Chilkat.Email(); // Add an embedded image to the HTML email. string cid = email.AddRelatedFile("dude.gif"); if (cid == null) { MessageBox.Show(email.LastErrorText); return; } // Update the HTML to reference the image using the CID string htmlBody = "<html><body>Embedded Image:<br><img src=\"cid:IMAGE_CID\"></body></html>"; htmlBody = htmlBody.Replace("IMAGE_CID",cid); // Set the basic email stuff: HTML body, subject, "from", "to" email.SetHtmlBody(htmlBody); email.Subject = "This is an HTML email with an embedded image."; email.AddTo("Chilkat Support","support@chilkatsoft.com"); email.From = "Programmer <programmer@chilkatsoft.com>"; success = mailman.SendEmail(email); if (!success) { MessageBox.Show(mailman.LastErrorText); return; } Important: The download for this
example does not contain the ChilkatDotNet.dll which |
© 2000-2013 Chilkat Software, Inc. All Rights Reserved.