-
I've downloaded a lot of VB samples showing how to send emails and email attachments using the winsock control. The problem I have is that for encoding attachments of a reasonable size using Base64 seems to be extremely slow. What can I do to speed up the encoding process? Are there faster alternatives to using the winsock control?
-
If you have Outlook on your machine you can send Emails/Attachments with this code.
(Remember to reference the Microsoft Outlook Object in your project references section.)
Code:
Set myOlApp = CreateObject("Outlook.Application")
Set myitem = myOlApp.CreateItem(olMailItem)
Set myAttachments = myitem.Attachments
'Add the attachment(s)
myAttachments.Add "C:\Test.txt", olByValue, 1, "Test File"
'Set the recipient name(s)
myitem.To = "Place Recipient Address Here"
'Send the Mail Item
myitem.Send
Hope this helps.
-
To add some more information to what I am trying to achieve. There are a few key things I am trying to do. Attach a file, change the sender name, and send as a custom form. I would like to build it into a component so that it can be reused. The immeadiate use is for a server based application which will send emails on behalf of other users. With CDO I seemed to be able to change the sender, but its not very nice cause it involved creating and deleting address entries. I am hoping (fingers crossed) there is a nicer way to do it from VB.