The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

configuration issues with simple MAPI

I want my Windows/C++ application to create an email window for the user's default mail client and add an attachment. I have written some MAPI code which works fine for me with Thunderbird and Outlook Express on XP and Windows 2000. However some users are having problems with it.

I have had a few friends and JoS regulars test it for me and quite a few (but not all) of them are reporting problems. I have no idea whether the problem is "DLL hell", how they have email configured on their machine or something else.

I have spent a couple of days going through MSDN, google and  www.google.com/codesearch , without success. Any ideas would be appreciated.

I can't use "mailto" as it doesn't support attachments. I can't use Outlook Redemption as it appears only to work for Outlook.

If anyone is interested, the code is here:
http://www.perfecttableplan.com/mapi/mapilib.cpp
(note it is Qt code, hence the QStrings and unpretty conversions to TCHARs).

I am dynamically loading "Mapi32.dll" (I believe its not possible to link it statically).

Windows 98 fails at this line on the call to LoadLibrary() ,  even though this is supposed to be supported in Windows 98. Not sure why.

On Windows 2000 and XP is fails either on the call to MAPILogon (returns E_FAIL) or MAPISendMail (returns MAPI_E_FAILURE).
Andy Brice Send private email
Monday, October 30, 2006
 
 
Andy, this probably isn't the answer you are looking for but when I researched whether to use MAPI or SMTP code in Surfulater, I opted for the latter and I'm glad I did.

MAPI seems problematic as you get different results depending on the users e-mail client. And you can't test every e-mail client out there. Another part of Surfulater, its crash handler, uses MAPI, and sometimes I get a WINMAIL.DAT file instead of the Zip file which should be attached.

If you want links to SMTP and MAPI code I'm using let me know.
Neville Franks Send private email
Monday, October 30, 2006
 
 
Neville,

Thanks for the offer. I prefer MAPI to SMTP becuase it allows the user to use the email client they are familiar with and to acess their address book easily. But I might take you up on it if I can't resolve the MAPI problems. Or possibly I could offer a choice of MAPI or SMTP?
Andy Brice Send private email
Monday, October 30, 2006
 
 
It's not an answer to your question, but a few years ago I was doing some MAPI work and bought a book (pdf) called insideMAPI - at the time, it was the only useful documentation I could find and it was thorough.

The book is here

http://www.insidemapi.com/

but it looks like the site hasn't been updated in a while.
Duncan Werner Send private email
Monday, October 30, 2006
 
 
What is the default mail client on the systems in which the code is failing? Also, what mail clients are installed on these systems?
MBJ Send private email
Monday, October 30, 2006
 
 
If you are reading inbox mail and checking attachments, you have to allow for the WINMAIL.DAT and ignore it. Outlook (Full not Express) generates it.

I have not heard of it failing on a Win98 machine. If you are just doing a LoadLibrary("MAPI32.DLL") then it likely means their Windows System folder has gotten out of their path or it was removed, but it sounds unusual to me.

I assume you double checked with those other people that their e-mail client is the default MAPI client. Sometimes Outlook Express gets knocked out of this by other installs, though I would assume it would be setting it to another MAPI client so you shouldn't get outright failure. Good luck with this.
Ben Bryant
Monday, October 30, 2006
 
 
>If you are reading inbox mail and checking attachments

I'm only trying to send email, not receive them.

>their Windows System folder has gotten out of their path

Even if I included a mapi32.dll in the same folder it didn't work. Windows 98 is only a very small aprt of my market so I haven't spent much time trying to work out why (yet).

>I assume you double checked with those other people that their e-mail client is the default MAPI client.

The ones I asked get an email window appearing when they click on a mailto: link.
Andy Brice Send private email
Monday, October 30, 2006
 
 
"Even if I included a mapi32.dll in the same folder"
This would not likely work because I think mapi32.dll has to find other DLLs. Can you put a GetLastError in there to find out why LoadLibrary failed? As for the SendMail error code I have no idea; usually there is a more helpful error indicating the attachments or recipients... Simple MAPI really is the way to go for your purpose though, so hopefully you can find out what these issues are.
Ben Bryant
Monday, October 30, 2006
 
 
You can get your test subjects to run fixmapi.exe in the windows/system32 folder and see if that makes a difference. It desgined to do what it says on the tin: fixes mapi by insuring that programs are using the correct verison.

Thursday, November 02, 2006
 
 
Oh yes and the search order of DLL'S was chanaged for windows XP sp1 so that system dll get loaded over the ones in the current directory.

From MSDN
"No longer is the current directory searched first when loading DLLs! This change was also made in Windows XP SP1. The default behavior now is to look in all the system locations first, then the current directory, and finally any user-defined paths."

Thursday, November 02, 2006
 
 
Thanks for the tips. I will investigate further.
Andy Brice Send private email
Thursday, November 02, 2006
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz