Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Send outlook express email from VB by using MAPI

Posted on 2004-10-17
9
Medium Priority
?
26,476 Views
Last Modified: 2008-01-09
I used following code to send email from my application, the outlook express did pop up, and the recipient email address is automatically inserted, and I type in the title of the message and the message itself, send it out without getting any error message, but the recipient never receive it, I appreciate if anybody has any idea what might be the problem?

 Private Sub btnEmail_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEmail.Click
        Dim mOutLookApp As Outlook.Application
        Dim mNameSpace As Outlook.NameSpace
        Dim mItem As Outlook.MailItem

        mOutLookApp = New Outlook.Application
        mNameSpace = mOutLookApp.GetNamespace("MAPI")
        'mNameSpace.Logon(, , False, True)

        mItem = mOutLookApp.CreateItem(0)
        mItem.To = txtEmail.Text
        mItem.Display()
    End Sub
0
Comment
Question by:cocoWang
  • 6
  • 2
9 Comments
 
LVL 11

Expert Comment

by:bingie
ID: 12335626
Does mItem.Send work?
0
 

Author Comment

by:cocoWang
ID: 12335690
When I insert mItem.send right after the line mItem.Display, I got following error message:

System.Runtime.InterOpServices.ComException(oxD0704005):Exception from HRESULT: oxD0704005.
at Outlook._MailItem.Send()

But the Outlook express still pop up, and I still can type in the message and send out message, the problem is message never reach the recipient side.
0
 
LVL 11

Accepted Solution

by:
bingie earned 450 total points
ID: 12335737
Your code works fine here - with a reference to MS Outlook 10.0, and the mItem.Send added.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:cocoWang
ID: 12335754
My MS Outlook is "Microsoft Outlook 9.0 Object Library", do you mean I have to download MS Outlook 10.0 version and try again?

I will try it anyway, and let you know the results.  Thanks for your help. Meanwhile do I have to install ansmtp, which can be downloaded  from internet?
0
 

Author Comment

by:cocoWang
ID: 12335800
I downloaded the file "officexp-kb828040-client-enu.exe" from internet, but when I try to open this file, I got error message

The expected version of the product was not found on your system

It is because I am using Outlook express, not Outlook, do we have Outlook Express version 10.0  ?
0
 

Expert Comment

by:niranjanrampure
ID: 12337428
why dont u use MAPI controls directly. i had done this .MAPI Uses u r default mailing program.it can be anything Outloox Express or outlook. but the only drawback i found with outlook was that  i could not send multiple attachment at one time .

try this :

1.select  Microsoft MApi Controls from component
2. add mapi session and mapi messaging control  to u r form
3. sign on with help of mapi session
   ----mapisession1.signon
4 assign mapisessionId to mapimessaging.session ID
-----mapimessage1.sessionId=mapisession1.sessionid
5. compose a new message
------mapimessage1.compose
6. open outlook address book with
 ------ mapimessage1.show
7. the mapi message control will pick up all the recipents addresses u sellect from the address book
8. u can add attachments-write text messages as well as write subject
9 use mapimessage1.send to send message
10 on sending message sign off



u can receive all u r messges and send all pending messages through mapi

0
 

Author Comment

by:cocoWang
ID: 12337876
Hi Bingie,

I have Outlook at office, and Outlook Express at home. This morning I tried to open that file 'officexp-kb828040-client-enu.exe' in the office, and hopefully it will load the Outlook version 10.0 on my PC, I got following message

"This update has already been applied or is included in an update that has already been applied"

Then I checked my Outlook, it is version '10.6515.6626' SP3.  So I ran my application again, and send my email, situation is the same, recipient did not receive the email, are you sure that you have tested my coding on your machine, and they worked fine?  Do I have to download other package?

0
 

Author Comment

by:cocoWang
ID: 12337901
Hi  niranjanrampure,

I would like to give it a try, maybe I will come up with some questions, and ask you later after my trial. Thanks for your help!
0
 

Author Comment

by:cocoWang
ID: 12338315
Hi Bingie,

Good news! Finally the recipients received the email, but it took about 20 to 35 minutes for recipient to get the message, is there any other command to speed up the process?
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The System Center Operations Manager 2012, known as SCOM, is a part of the Microsoft system center product that provides the user with infrastructure monitoring and application performance monitoring. SCOM monitors:   Windows or UNIX/LinuxNetwo…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question