/// <summary> /// Sends the mail message. /// </summary> private void _ShowMail(bool sync) { MapiHelperInterop.MapiMessage message = new MapiHelperInterop.MapiMessage(); using (RecipientCollection.InteropRecipientCollection interopRecipients = _recipientCollection.GetInteropRepresentation()) { message.Subject = _subject; message.NoteText = _body; message.Recipients = interopRecipients.Handle; message.RecipientCount = _recipientCollection.Count; // Check if we need to add attachments if (_files.Count > 0) { // Add attachments message.Files = _AllocAttachments(out message.FileCount); } if (!sync) { // Signal the creating thread (make the remaining code async) _manualResetEvent.Set(); } const int mapiDialog = 0x8; //const int MAPI_LOGON_UI = 0x1; const int successSuccess = 0; int error = MapiHelperInterop.MAPISendMail(IntPtr.Zero, IntPtr.Zero, message, mapiDialog, 0); if (_files.Count > 0) { // Deallocate the files _DeallocFiles(message); } // Check for error if (error != successSuccess) { _LogErrorMapi(error); } } }