by Dogs (2 Submissions)
Category: Custom Controls/Forms/Menus
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating:
(2 Votes)
This code once compiled to an ocx, can be added as a user control to any VB6 form.
It allows you the user to send an mail via an smtp server, but where this code shines is the ability to add an attachment to your Email.
Inputs
Email1.MailFrom = "[email protected]"
Email1.MailMessage = "This is a test"
Email1.MailSubject = "This is a test"
Email1.MailTo = "[email protected]"
Email1.PortNumber = 25
Email1.ServerName = "your smtp server"
Email1.Attachment = "C:\Newsletter-v1.jpg"
Email1.SendMail
Code Returns
An event is raised MailFailed
this returns a number but there is a public variable within the routine that returns as text
the actual Text, this can be an error message or a message to say Mail Sent Successfully
Download Email with Attachments (19 KB)