Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
Send Very Simple HTML Email
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.