Sending Outlook E-mail via VB


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 7 of 7

Thread: Sending Outlook E-mail via VB

  1. #1
    Join Date
    Dec 2005
    Posts
    13

    Sending Outlook E-mail via VB

    I am using VB6-SP6 to develop an app with an Access DB backend. I want to be able to take data that the user sees displayed on the screen and have that data e-mailed to another user as desired. The app will be used in an environment that uses MS Exchange/MS Outlook. I was hoping there is a way to have a new Outlook message open up with the message text and subject populated (with the information from the app) and then the user can select a recipient from the Outlook address book to send the message to. Is there a way to do that?

    All the solutions I've found on the web and newsgroups seem to be geared to creating the message from scratch with the user manually entering in the recipient e-mail address.

    TIA,
    The Merg
    Today's problems don't worry me,
    I haven't solved yesterday's yet.

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  3. #3
    Join Date
    Dec 2005
    Posts
    13
    That seems to do exactly what I want. One more question though. How do I get a picture from an image box into the e-mail. I tried inserting the .Picture property into the body, but it only displays the Long Integer that the picture is equivalent to.

    Thanks again,
    The Merg
    Today's problems don't worry me,
    I haven't solved yesterday's yet.

  4. #4
    Join Date
    Dec 2005
    Posts
    13

    Outlook Reference in VB

    I actually found another thread that seems have the code that will help me out. I have one question though... how do I reference Outlook in VB? I cannot seem to find any example out there as to what the syntax of this reference line is.

    Thanks,
    The Merg
    Today's problems don't worry me,
    I haven't solved yesterday's yet.

  5. #5
    Join Date
    Feb 2006
    Posts
    11
    Hi,
    Could you direct me to the thread that will show how to insert a picture in the body of the email? I have an Outlook macro that generates emails for me, and I can't seem to get it to insert a picture in the email. (I am using the MailItem Outlook object). Word seems to use the inlineshapes method, but the MailItem object does not seem to support that.
    Thanks!

  6. #6
    Join Date
    Dec 2005
    Posts
    13
    The code someone suggested to me that I used is as follows:

    Code:
    Set a reference to Outlook first
    
    Dim oOApp As Outlook.Application
    Dim oOMail As Outlook.MailItem
    
    Set oOApp = CreateObject("Outlook.Application")
    Set oOMail = oOApp.CreateItem(olMailItem)
    
    With oOMail
        .Subject = lstr_Subject
        .Body = lstr_Body
        .BodyFormat = olFormatRichText
        .Attachments.Add lstr_PicturePath, olByValue, 1, lstr_Subject
        .Display False ' True makes the e-mail form modal
    
    End With
    In order for me to get the picture from my app into the e-mail, I first save it to a file and then set the Attachment as above. Once the e-mail is sent, I delete the file from the hard drive.

    HTH,
    The Merg
    Today's problems don't worry me,
    I haven't solved yesterday's yet.

  7. #7
    Join Date
    Feb 2006
    Posts
    11
    Thanks. I actually thought you had figured a way to display the image in the body of the email, rather than just attach the file as an icon.

Similar Threads

  1. Sending sms in VB 6.0 Using Pdu mode
    By snperchery in forum Mobile
    Replies: 0
    Last Post: 11-02-2005, 11:35 PM
  2. sending values to Outlook Express
    By kaustav in forum Java
    Replies: 0
    Last Post: 03-07-2002, 10:29 AM
  3. Replies: 84
    Last Post: 01-29-2001, 02:12 PM
  4. Replies: 0
    Last Post: 01-15-2001, 12:36 AM
  5. VB, Outlook, and Encryption
    By Todd Lawrence in forum VB Classic
    Replies: 2
    Last Post: 05-03-2000, 02:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center