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.

make mapi non model?

Funny, there is a topic just a few down from this post explaining the ills/woes of using simple mapi!

I have a set of routines (in VB, but converted to VBA) that use the MAPI32.DLL windows api.

Despite the nays in that previous post, I do find the mapi api’s quite nice, and they are quite reliable.

The problem is that when launching the email client, if I choose to display the email client, then the whole process becomes modal, and that is not what I want.

I hunted around a bit on MSDN..and can’t find a solution.

I can setup the message, subject, and even multiple attachments no problem.  I then display the email message, and the user can edit, or send. The problem is that the calling code WAITS (is modal) until the user hits send, or closes the email (I don’t care which the user does).

Anyone know how to use mapi, but not be modal?

MAPISendMail(Session as Long,
          UIParam as Long,
          Message as MapiMessage,
          Recips as MapiRecip,
          Files as MapiFile,
          Flags as Long,
          Reserved as Long) as Long

The above is the api call. Perhaps I create a small stand alone program that gets launched (or shelled out to) that would THEN call the MAPI Send mail? This would fix the model problem (that small program would remain loaded untill user hits send).
I am open to other suggestions here.  Of course, if I use outlook automation, then the modal problem goes away, but that means my software then depends on outlook, and I would rather support any email client that is simple-mapi compatible. 

I would actually use windows shell, and super easy sendto: (like many web sites do), but this does not allow for attachments.


Albert D. Kallal
Edmonton, Alberta Canada
Albert D. Kallal Send private email
Wednesday, July 26, 2006
Why not just show your own UI?
Almost H. Anonymous Send private email
Wednesday, July 26, 2006
>Why not just show your own UI?

I could, but then that is *different* then what the user is currently using. I mean, if they use Eudora, or Outlook express, or Outlook all day long, then launching a familiar email client for them to use is rather nice.

Further, sometimes the defaults for the email client are HTML,  rich text, or in my case, I set things to plain text.

Further, the user has full access to their address books for the CC, and BC fields in case they want to add to this. And, further, all kinds of settings like fonts, and even their signature (sig line) are respected if I can use their current email client (after all, they choose that email system, and there is a LOT of settings and preferences that THEY like.

Hence, I do launch the email with a pre-made subject, recipient name set, and a pdf file already attached (this is usually a invoice, or a tour confirmation being sent).

By using the standard email client, they are free to add additional recipients, or even attached more information (such as brochures, or price list’s etc). So, using the default email client simply allows my users to leverage HOW THEY work now, and no new training is required.

However, stop the presses!!!

I just tested launching ANOTHER program to use the MAPI, and it returns a error telling me that a outlook ALREADY has a dialog box open!!!

What this means is that MAPI is modal, and launching another process or another piece of software to get around this limitation is NOT POSSIBLE
(Unless some mapi dude has experience telling me otherwise).

So, I can shell out and start another process to launch the default email client, and the user will be able to RETURN to my application (so, I do solve ONE model issue!!!). I want user to be able return to the application in case the phone rings, or they want to deal with a different customer.

The problem with model forms is that when I launch the email client, then my users CAN NOT return back to work (back to my application) until they close the email. Well, golly, many people start a email and then the phone rings, and they have to do something else. (This is a reservation system..and you often get interrupted during the day).

So, I can launch another process to allow the email client to be used non model. However, if while again using my software, they launch ANOTHER email, it will NOT work. Thus, simple mapi is modal, and I can NOT have more then one email client open at the same time if I use the simple-mapi interface.

I suppose I should point out that right now, I use outlook automaton, and thus can launch as many email client windows as I please without trouble. As mentioned, complex invoices are attached as pdf files in my case.

Anyway,  some progress has been made, as I can remove the first model email problem by shelling out (starting another process). However, if my users then attempt to start another email from my application, it will not work…

Now I have to decide what to do, and I don’t like the answers…

Albert D. Kallal
Edmonton, Alberta Canada
Albert D. Kallal Send private email
Wednesday, July 26, 2006
We just don't use MAPI.  There are a ton of good SMTP controls out there.  (Of course we route the mail through our SQL Server, and it sists there in a queue...)

I really like SQLAnswersMail.
Cade Roux Send private email
Wednesday, July 26, 2006
This may sound really silly, but have you tried launching a "mailto:" URL instead of calling into simple MAPI? You can specify subject lines etc., and the shell should route this to the email app, which will pop up as a separate process.

The downside is that you don't know when they hit the Send button.
Chris Tavares Send private email
Wednesday, July 26, 2006
Have a look at Redemption (google "outlook redemption").
Justin Send private email
Thursday, July 27, 2006
Chris: mailto works fine but does not support attachments. Mapi does.
Chris Nahr Send private email
Thursday, July 27, 2006
"but have you tried launching a "mailto:" URL instead of calling into simple MAPI?"

I don't think you can attach files using a mailto: link -- that's one of the requirements.
Almost H. Anonymous Send private email
Thursday, July 27, 2006

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

Other recent topics Other recent topics
Powered by FogBugz