With this class object you can send Email using the SMTP protoclol. In general it works like this: Set the properties then call the send method. You can add multiple attachments to the email and it is possible to send HTML formatted mail
There are much more properties, methods and events available than the demo below will show you. Some of the available properties are: Importance, Priority, MSMailPriority, ExpiryDate, Sensitivity, MessageFlag and ReplyBy
Attachments are seperated by a ; You can make these attachments visible inside your HTML email by giving them a name. You can do that by putting a | in front of it and the name before that. sample: attachmentname|attachment.gif You can then show that file (image) in your HTML email with a tag like: <img src=”cid:attachmentname”> This way you can send email messages with embeded pictures without the need for the recipient to click on the download pictures warning.
Click here to download the complete source code, the compiled DLL and the demo.
Here is some sample code:
Public WithEvents SMTPMail As EVICT_SMTP.SMTP
Private Sub cmdSend_Click()
Set SMTPMail = New EVICT_SMTP.SMTP
SMTPMail.SMTPHost = "smtp.myprovider.com"
SMTPMail.SMTPPort = 25
SMTPMail.From = "email@example.com"
SMTPMail.FromDisplayName = "Edwin Vermeer"
SMTPMail.Recipient = "firstname.lastname@example.org"
SMTPMail.RecipientDisplayName = "It's You"
SMTPMail.CcRecipient = "email@example.com"
SMTPMail.CcDisplayName = "Someone else"
SMTPMail.BccRecipient = firstname.lastname@example.org
SMTPMail.ReplyToAddress = "email@example.com"
SMTPMail.AsHTML = Me.chkHTML
SMTPMail.Attachment = "image|c:\windows\Greenstone.bmp"
SMTPMail.Subject = "this is just a test"
SMTPMail.Message = "<html><h1>Hello</h1><br/><img
On Error Resume Next
If Err.Number <> 0 Then MsgBox "Error:" & Err.Number & _
vbCrLf & Err.Description, vbCritical, "Could not send mail"
On Error GoTo 0