Visual Basic Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

VB Examples

Bounced Mail
Bz2
Character Encoding
CSV
Digital Certificates
Digital Signatures
Email
FTP
HTML-to-XML
HTTP
IMAP
Encryption
MHT / HTML Email
POP3
RSA
S/MIME
SFTP
SMTP
Socket
Spider
SSH
SSH Key
SSH Tunnel
String
Tar
Unicode
Upload
XML
XMP
Zip Compression

More Examples...
Email Object
FileAccess
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
DH Key Exchange
DSA


VB Strings
VB Byte Array

Unreleased...
Bzip2
LZW
Icon

 

 

 

 

 

 

 

Create and Send HTML Mail

Download Chilkat Email ActiveX

This VB6 example program shows how to manually construct and send an HTML mail.


' VB source code to create a simple HTML email and send it.
' This example manually builds the HTML mail.

' (An alternative is to use the Chilkat MHT component in conjunction with
' Chilkat Mail to automate the creation of HTML mail from
' HTML files or Web pages (URLs).)
Private Sub Command1_Click()
    
    ' Create a mailman object for sending HTML email
    Dim mailman As ChilkatMailMan2
    Set mailman = New ChilkatMailMan2
    
    mailman.UnlockComponent "Anything works to start 30-day trial"
    
    ' Set the SMTP host.
    mailman.SmtpHost = "smtp.comcast.net"
    
    ' Only set the username/password if the SMTP server requires it.
    'mailman.SmtpUsername = "my_username"
    'mailman.SmtpPassword = "my_password"
    
    ' Create the email, add content, address it, and sent it.
    Dim email As ChilkatEmail2
    Set email = New ChilkatEmail2
    email.AddTo "Chilkat Admin", "admin@chilkatsoft.com"
    email.AddTo "Chilkat Gmail", "chilkat.support@gmail.com"
    email.AddTo "Chilkat Yahoo", "chilkat_software@yahoo.com"
    email.subject = "This is a test"
    
    imageContentID = email.AddRelatedFile("c:/temp/dude.gif")
    
    email.SetHtmlBody ("<!DOCTYPE HTML PUBLIC " & Chr(34) & _
        "-//W3C//DTD HTML 4.0 Transitional//EN" & Chr(34) & _
        "><HTML><HEAD></HEAD><BODY>" & _
"<br>This is an example of embedding an image in HTML email.<BR><IMG SRC=" & _
Chr(34) & "cid:" & imageContentID & Chr(34) & _
"><br>(The content ID of the image looks like this: " & _
imageContentID & "<br>The <b>HTML</b> for embedding the image looks like this: <img src=" & _
Chr(34) & "cid:" & imageContentID & Chr(34) & "><br></BODY></HTML>")
    
    email.AddPlainTextAlternativeBody "This is the plain text"
    
    email.From = "support@chilkatsoft.com"
        
    ' Call SendEmail to send HTML email.
    success = mailman.SendEmail(email)
    If (success = 1) Then
        MsgBox "Mail Sent!"
    Else
        MsgBox mailman.LastErrorText
    End If
    
    Set email = Nothing
    Set mailman = Nothing
    
End Sub

 

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

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