tags:

views:

143

answers:

1

I am writing a c# .net application that needs to send email messages using MAPI. I am using the following library to achieve this http://www.codeproject.com/KB/IP/SendFileToNET.aspx Here is an example how I use it.

MAPI mapi = new MAPI();
mapi.AddRecipientTo("[email protected]");
int returncode = mapi.SendMailPopup("subject", "message");
if(returncode==0)
{
MessageBox.Show("User sent message");
}
else if (returncode==1)
{
MessageBox.Show("User abort");
 }

This piece of code opens a new message dialog on default mail program and should display if user decided to send or abort sending the email.

This code works fine when using Outlook meaning that it popups a new email dialog and returns the correct error code if user for example decides not to send the message by closing the message dialog.

The problem is that when using windows mail this does not work correctly. The send mail dialog opens correctly and the application pauses its execution on mapi.SendMailPopup until the mail dialog is closed. However no matter what the user does the mapi.SendMailPopup always return zero. If user would for example decide to close the message dialog without sending the message the mapi.SendMailPopup returns 0 when the correct response would be 1(user abort).

My question is should windows live mail have required MAPI-support for this, and if no can someone tell me some other free windows mail client that would offer the required MAPI-support

+1  A: 

This is confusing-- that .NET solution is SMAPI, not MAPI. I'm not sure how reliable the return values from SMAPI are, especially since the return value is returned directly from your default MUA vendor's implementation of SMAPI, and there are at least a dozen of them out there. Since the browser doesn't use the return value, and they're the principal clients of SMAPI, I wouldn't rely on it.

Cain T S Random
Can you point me some better .net mapi implementation.
Jargo
I'm not sure what else is out there. Again, if it works except for the return value, just ignore the return value; I'm not sure what it would be used for anyway other than logging.
Cain T S Random