1
votes

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
Microsoft is trying hard to get rid of MAPI. This would be one way...Hans Passant
What are the alternatives? I need send email messages from my application using external mail program.Jargo
The alternative is either the Outlook Object Model if you want to pipe messages through there and take advantage of them being in Sent Items, using signatures and so on, or SMTP.Alan B

1 Answers

1
votes

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.