Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
Send HTML Email with Embedded ImageC# 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 |
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2008 Chilkat Software, Inc. All Rights Reserved.