Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

using MAPI to email from VB

Posted on 2002-05-16
3
Medium Priority
?
1,115 Views
Last Modified: 2010-05-18
I have a form showing contact data for clients and an email button to open the default MAPI client ready to fill in a message to the address shown on the form. The code behind the button is

Private Sub cmdemail_Click()
 cmdemail.Enabled = False
 MAPISess.Action = 1
    MapiMess.SessionID = MAPISess.SessionID
    MapiMess.Compose
MapiMess.RecipAddress = email.Text
MapiMess.Send (True)
End Sub

On a machine using Outlook Express as the email client everything works well clicking on the button opens Outlook Express  with the recipients address filled in ans the email can be sent.

When the program is run on a PC running Outlook 2000
The code halts at 'MapiMess.Send (True)'

and I get the error message 'runtime error 32002 Unspecified failure has occured'

Anybody seen this before and know of a work around.

I need the function to work in both Outlook and outlook express.

Thanks

Rick

I get the Message
0
Comment
Question by:Aerocom
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 7013798
better use this free component to send mail: http://www.freevbcode.com/ShowCode.Asp?ID=109
0
 
LVL 4

Accepted Solution

by:
Glowman earned 400 total points
ID: 7013871
Aerocom,
I had the exact same problem using the MAPI controls and I found out that you need to use the "ResolveName" method before each address is added.  So your code would be changed to this :

Private Sub cmdemail_Click()
cmdemail.Enabled = False
MAPISess.Action = 1
   MapiMess.SessionID = MAPISess.SessionID
   MapiMess.Compose
MapiMess.RecipAddress = email.Text
MapiMess.ResolveName   **~~**(Add this line)
MapiMess.Send (True)
End Sub

By adding that line you should be good to go.

G
0
 
LVL 1

Author Comment

by:Aerocom
ID: 7013926
Thanks Glowman it did the trick!!

It now works with outlook as well as O express.

I've been trying for days to find out what the error refered to but no luck on MSDN. Prooves that Experts Exchange is the place to go for those solutions that MS cannot or will not provide!!

Now I have to find out if it will work with Lotus Notes which a couple of my clients use.

Thanks again

Rick
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

610 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