Tim Pohlmann
Tim Pohlmann

Reputation: 4440

MAPI call without blocking application

My application is sending E-Mails via a MAPI call:

[DllImport("MAPI32.DLL")]
static extern int MAPISendMail(IntPtr sess, IntPtr hwnd, MapiMessage message, int flg, int rsv);

and somewhere else:

m_lastError = MAPISendMail(new IntPtr(0), new IntPtr(0), msg, how, 0);

This works well except for one problem: The outlook window will completely block the application.
This seems to be the intended behavior but I would like to not have it behave this way. Any ideas?

I tried calling MAPI from a background thread, but it seems that's not possible.

Upvotes: 0

Views: 555

Answers (1)

Dmitry Streblechenko
Dmitry Streblechenko

Reputation: 66286

That is just the way Simple MAPI works - use OOM instead (Application.CreateItem / MailItem.Display(false)).

Upvotes: 2

Related Questions