Results 1 to 3 of 3

Thread: Sending Email Attachments

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Posts
    87
    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?

  2. #2
    Lively Member Ishamel's Avatar
    Join Date
    Nov 1999
    Location
    Edinburgh, Scotland
    Posts
    112
    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.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Posts
    87
    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.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width