Zip Component, Email Component, Encryption Component ActiveX Control for Zip Compression .NET Components for ASP.NET
ActiveX and .NET Components for Zip Compression, Encryption, Email, XML, S/MIME, HTML Email, Character Encoding, Digital Certificates, FTP, and more ASP Email ActiveX Component

  

  

  Chilkat ActiveX Components

  Chilkat .NET Components

  Chilkat C++ Libraries

  

  

  

  

 

FAQ

DOWNLOAD ReferenceChilkat Log ReferenceVersions

MHTML Features

Chilkat Mail makes it easy to send and receive HTML formatted emails with embedded, internally referenced images. The standard way of doing this is to format emails using a MIME content type called "multipart/related". Chilkat Mail does this for you, and you don't have to know anything about the structure of "multipart/related" MIME messages. (For those that do, Chilkat Mail does handle "multipart/alternative" messages contained within "multipart/related". If fact, ChilkatMail can handle messages of any complexity.)

Sending a HTML email with an image:

Here is an example of creating and sending an email that has an HTML body, and references an internal image.

    Dim mailman As Object
    Set mailman = CreateObject("ChilkatMail.ChilkatMailMan")
    
    ' Get the free unlock-code from http://www.chilkatsoft.com
    mailman.UnlockComponent "unlock-code"
    mailman.SmtpHost = "my.smtpserver.com"
    
    Set email = New ChilkatEmail
    email.AddTo "Bill Yahoo", "yahoo@chilkatsoft.com"
    email.Subject = "Here is some HTML with an image."
    email.Body = "This is an email from Chilkat Software."
    email.From = "fausey@chilkatsoft.com"
    
    ' Add an image
    contentID = email.AddRelatedContent("sample.gif")
    
    ' Set the email body, and reference the image
    htmlBody = "<HTML><HEAD></HEAD><BODY><br>"
    htmlBody = htmlBody & "This is an example of embedding an image in HTML email."
    htmlBody = htmlBody & "<BR><IMG SRC=" & Chr(34) & "cid:" & contentID & Chr(34)
    htmlBody = htmlBody & "><br><br></BODY></HTML>"
    
    email.SetHtmlBody htmlBody
    mailman.SendEmail email
    Set email = Nothing
    Set mailman = Nothing

Sending a HTML email with an image and also with a plain-text alternative for Email clients that cannot accept HTML:

Just modify the code above by adding this line:

    email.AddPlainTextAlternativeBody "This is the plain-text body"

This line can be added anywhere after the email is created, but before it is sent.

Sending a HTML email with an image, an MS-Word file attachment, and also with a plain-text alternative:

Just modify the code above by adding this line:

    email.AddFileAttachment "sampleWordDoc.doc"

This line can be added anywhere after the email is created, but before it is sent.

If you created an email with related content, a plain-text alternative, and an attached file, the MIME that would be created is a "multipart/alternative" within a "multipart/mixed" within a "multipart/related". ChilkatMail can send and receive emails this complex. Microsoft Outlook can handle it. But many email clients are not sophisticated enough to handle such a beast, however properly formatted it happens to be. (The point here is that even though ChilkatMail can handle something very complex, many mail clients won't.)

 


Privacy Statement. Copyright 2000-2008 Chilkat Software, Inc. All rights reserved.
Send feedback to support@chilkatsoft.com

Components for Microsoft Windows XP, 2000, 2003 Server, Vista, and Windows 95/98/NT4.