MAPIInitialize(Null) fails and returns -2147467259 as error code in Windows 7 32 bit OS

Dec 29, 2010 at 9:49 AM
Edited Dec 29, 2010 at 9:55 AM

Hi,
My application calls MAPIInitialize(NULL) in order to send and receive mails, the problem is MAPIInitialize(Null) is getting failed and returns the error code as -2147467259 followed by a message "There is no email program associated to perform the requested action. Please install an email program or, if one is already installed, create an association in the Default Programs control panel"

I'm using Windows 7 (32 Bit OS) as my testing environment which doesn't have any default mail client in it. 


For using a mail client in Windows 7, Microsoft suggested to download the Windows Live Mail (email client for windows 7). Based on that suggestion i had downloaded and installed the Windows Live Mail in my Windows 7 machine. But the same error message box appeared during the verification. Also i had made the Windows Live Mail as a default mail client in windows 7 by setting its property in the “Start\Run\DefaultPrograms” but that also did not solve this issue.
if i install MS Office outlook and the problem gets disappeared.

Any suggestions would be helpful.

Thanks!
Regards,
Vignesh S

Note:
If i use my application in Windows XP, there is no issue since default mail client is MS outlook express also if i use my application in Windows vista it contains Windows Mail as a default mail cilent

 


Coordinator
Dec 30, 2010 at 1:45 PM

Ok – first things first – in order to use any form of MAPI, you must have a client installed which implements MAPI. Windows 7 does not come with any sort of MAPI client installed.

According to the registry, Windows Live Mail does implement Simple MAPI:
HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\Windows Live Mail
And it’s implemented by the following DLL:
C:\Program Files (x86)\Windows Live\Mail\smapi.dll
Which we can confirm (using depends.exe) does export the Simple MAPI functions.

So – after installing Windows Live Mail, you should be able to use it for Simple MAPI. However, it does not implement Extended MAPI.

Since your program worked after installing Outlook (which implements Extended MAPI), I'm going to assume you're actually using Extended MAPI. Further, I'm going to assume that MAPIInitialize actually succeeded after installing Windows Live Mail, and the call which really failed was MAPILogonEx, which I would expect to fail if Windows Live Mail is your default client.

You can clear things up here and get a better answer if you can clarify if you're using Simple MAPI or if you're using Extended MAPI in your application.

Dec 31, 2010 at 6:08 AM

Hi ,

Thanks fo the reply!

Yes i'm using extended MAPI, but in my case ,my first call is to MAPIInitialize before calling MAPILogonEX and MAPIInitialize itself is getting failed and inturn throwing an error message "There is no email program associated to perform the requested action. Please install an email program or, if one is already installed, create an association in the Default Programs control panel" and hence MAPIInitialize is the one which is reponsible for throwing the error message. I checked the "C:\Program Files (x86)\Windows Live\Mail\smapi.dll
and found the same dll in my machine and i agree that i cannot use extended functionality.  but is there any specific reason for MAPIInitialize(NULL) getting failed in Windows 7 after installing Windows Live Mail as an email client?

Thanks!

Regards,

Vignesh S

Coordinator
Jan 4, 2011 at 2:19 PM

That's not what I would expect but I don't have a Windows 7 machine here without Outlook on it to test out what you're seeing. Since you wouldn't be able to use Extended MAPI anyway it doesn't seem this should be a big concern.