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

 

 

 

 

 

 

 

Send Very Simple HTML Email

Download Chilkat Email ActiveX

Visual Basic sample code showing how to send a very simple HTML email.

' This Visual Basic example program to send a very
' simple HTML email.
Private Sub SendMail_Click()

    ' Create a MailMan instance to send email
    Dim mailman As New ChilkatMailMan2
    
    ' Unlock the email component - anything begins the 30-day trial.
    mailman.UnlockComponent "UnlockCode"
    
    ' Change this to your SMTP server.
    mailman.SmtpHost = "smtp.earthlink.net"

    ' Create an email for sending
    Dim email As New ChilkatEmail2
    
    ' Set the email subject
    email.Subject = "test"
    
    ' Set the HTML email body
    email.SetHtmlBody "<html><body><font face=""Courier New"" size=""3"">This text has a specific font and size.</font></body></html>"

    ' Add a plain-text alternative for recipients that may not be able to display HTML.
    email.AddPlainTextAlternativeBody "If the recipient uses an email client that cannot " + _
        "display HTML, then this plain-text alternative will be displayed."
    
    email.AddTo "John Doe", "john@chilkatsoft.com"
    email.AddCC "Matt", "matt@chilkatsoft.com"
    email.FromAddress = "bill@chilkatsoft.com"
    email.FromName = "Bill Doe"
            
    ' Send mail.  Returns 1 if successful, 0 if failed.
    success = mailman.SendEmail(email)
    If (success = 0) Then
        ' Save errors to a log file.
        MsgBox mailman.LastErrorText
        mailman.SaveLastError "errorLog.xml"
    Else
        MsgBox "Message Sent!"
    End If
    

End Sub

 

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

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