Use wodSmtp with VB6 to send an e-mail with HTML formatting

For a copy of the sample project please
click here
to download and install the product evaluation.
Introduction
wodSmtp is a Client ActiveX Component that is used to deliver email messages directly to the server of the recipient, using the SMTP protocol. It automatically uses DNS to find the correct SMTP server that the message should be delivered to, or uses SmartHost through the Hostname property. It includes several one-line methods for sending the entire email (including attachments). It can also load prepared messages (created with Outlook, Outlook Express or any other client), reformat it, change it
Detail
Our demonstration code illustrates how to send an e-mail with HTML formatting using a relatively small amount of code.
Instructions
Download and run the executable from the above link. The samples will
be placed in the directory C:\Program Files\WeOnlyDo.Com\Smtp\Samples.
There are example projects for VB, ASP, Delphi 6, VC and VBS.
In the VB6 project, the control wodSmtp is placed on the Form1 and all the event handlers are provided by the development environment.
In this example we ask a user for the required information (sender's e-mail, recipient, message body, etc.) using text boxes. Once all the information has been entered, the sending process is initated by clicking the button on the form:
VB6
Private Sub Command1_Click()
wodSmtp1.SendTextHtml txtFrom.Text, txtTo.Text, txtSubject.Text, txtPlain.Text, txtHTML.Text
End Sub
As you can see, there is no need to specify a hostname or any other mail server specific information because wodSmtp will automatically find the default MX DNS record for the recipient.
The event Done is also handled :
VB6
Private Sub wodSmtp1_Done(ByVal ErrorCode As Long, ByVal ErrorText As String)
If ErrorCode = 0 Then
MsgBox "Email sent!"
Else
MsgBox ErrorText
End If
End Sub
The above code will display a message box to notify us if the message was sent successfuly.
Summary
This simple demonstration shows an easy way to enable out VB6 application to send an e-mail with HTML formatted text in one simple step.
Visit
WeOnlyDo! Inc.
for more information and more samples.