Results 1 to 3 of 3

Thread: Send Email With Outlook

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2005
    Posts
    76

    Send Email With Outlook

    Hi Can Some Tell Me The Code That Opens Outlook Express To Send A Message And Adds The Email You Want To Send It To .

    Thanks

  2. #2
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: Send Email With Outlook

    Try this
    VB Code:
    1. 'strEmailRequestor is the person sending the email
    2. 'strEmailSubject is the subject
    3. 'strEmailBody is the text of the email
    4.  
    5. Public Sub generate_email()
    6. Dim objOutlook As Object
    7. Dim mailRequestor As Object
    8.  
    9.   On Error GoTo GenerateError
    10.  
    11.   Set objOutlook = CreateObject("Outlook.Application", "localhost")
    12.  
    13.   Set mailRequester = objOutlook.CreateItem(olMailItem)
    14.  
    15.   mailRequester.To = strEmailRequester
    16.   mailRequester.Subject = strEmailSubject
    17.  
    18.   mailRequester.Body = strEmailBody
    19.  
    20.   mailRequester.Send
    21.   Exit Sub
    22.  
    23. GenerateError:
    24. 'handle your errors here
    25. End Sub
    although it triggers Outlook's security "feature", so it's better to not use Outlook to send mail.
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

  3. #3
    Hyperactive Member sheikh78's Avatar
    Join Date
    Apr 2006
    Location
    C:/
    Posts
    423

    Re: Send Email With Outlook

    Why don't you just search google. I know there is a thing that will let you do this. My suggestion is having a Process and using an html code.

    Something like this
    VB Code:
    1. Process.start("mailto: whomever")
    Then just search online for the mailto thing on how to add a richtextbox's text in there and you are set.
    "Imagination is more important than knowledge" - Albert Einstein, born on March 14th 1879.
    Can't find it here on VBForums? Go to the CodeProject. MSDN is your friend . I have such a bad website, my friend decided it would be funny to change the template and he moderates the site for me: visit my site!

    "Thinking of you, wherever you are
    We pray for our sorrows to end, and hope that our hearts will blend.
    Now I will step forward to realize this wish.
    And who knows, starting a new journey may not be so hard…
    Or maybe it has already begun.
    There are many worlds, but they share the same sky
    one sky, one destiny..."

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