vbSendMail.dll Version 3.65-- Easy E-mail Sending in VB, with Attachments

Category:
Network/Internet
Type:
Classes
Difficulty:
Advanced
Author:
Dean Dusenbery

Version Compatibility: Visual Basic 6

More information:
MOST RECENT VERSION UPGRADES (See documentation for full list):
  • v 3.65 09/10/2003:Add MaxRecipients Property,Improved compatibility on SMTP login authentication,removed extra blank line at beginning of message body, updated top-level domain list used in verifying whether an email address is valid, minor bug fixes.
  • v 3.54 03/23/2002:Minor bug fixes, including one incompabitbility with some Windows XP systems.
  • v 3.52 01/27/2002:Support for servers (like Yahoo.com) that require POP3 authentication before sending. Minor bug fixes and logic enhancements.
  • v 3.51 07/23/2001: Added support for automatically detecting the SMTP host through name server MX lookup. Added support for sending embedded images within HTML mail. Minor bug fixes and enhancements.
This project was originally developed by FreeVBCode.com, but Dean Dusenbery has taken ownership of it since version 2.0. He has done numerous version upgrades since that time. These upgrades represent a major improvement to the previous version. Thanks to Dean, the component is clearly of commericial quality, and probably one of the best available, commericial or non-commerical. FreeVBCode.com, along with all users of this component extend their eternal gratitude.

If you've ever wanted to send simple e-mail messages with Visual Basic, and you've tried struggling with third party .OCXs or Microsoft's unwieldy MAPI or CDO libraries, the vbSendMail.dll is for you. This simple to use component supports multiple file attachments and multiple copies of the same e-mail.

Sending an e-mail with this .dll is as simple as the following:

'Module Level Declaration (WithEvents optional but recommended)
Private WithEvents poSendMail as vbSendMail.clsSendMail
Private Sub cmdSend_Click()
'Assumes you have a form with text boxes named as below

set poSendMail = new vbSendMail.clsSendMail
poSendMail.SMTPHost = txtServer.Text
poSendMail.From = txtFrom.Text
poSendMail.FromDisplayName = txtFromName.Text
poSendMail.Recipient = txtTo.Text
poSendMail.RecipientDisplayName = txtToName.Text
poSendMail.ReplyToAddress = txtFrom.Text
poSendMail.Subject = txtSubject.Text
poSendMail.Attachment = txtFileName.text 'attached file name
poSendMail.Message = txtMsg.Text
poSendMail.Send
set poSendMail = nothing
End Sub

For multiple file attachments, an example would be:

poSendMail.Attachment = txtFileName1.text & ";" & txtFileName2.text

Note that this is only a small example of the component's capabilities and options, and you can use it for simple purposes, as described above, or use any number of its advanced features, as described in the documentation.

Two sample clients with .vbgs and detailed documentation are included.


Instructions: Click the link below to download the code. Select 'Save' from the IE popup dialog. Once downloaded, open the .zip file from your local drive using WinZip or a comparable program to view the contents.

Download vbsendmail.zip