Search code examples
c#mapiemail-clientemail-attachments

Is there a simple way of sending an email with attachments using the default mail client?


My issue is that I need to attach files with C# to the default mail client and show it to the user, much like using mailto:.

I read this post on the subject, but there are several issues:

  1. I do not want to use mailto because attachments are not officially supported.
  2. When using System.Net.Mail and the SMTP class (code supplied in the accepted answer), I am not sure how to pop up the message for the user to handle instead of just mailing it. Not sure if this is even possible.
  3. Also when using the solution above (#2) I'm not sure how to get the user's email server.
  4. In an answer supplied further down, a Code Project solution is presented using a custom wrapper for MAPI32.DLL. The issue here is that the license agreement specified by the writer of the article for this solution conflicts with the requirements that I am under for my project.
  5. Due to time restrictions I cannot write my own MAPI wrapper

So, are there any other simple solutions to this problem? Is there another simple way to pop up the default mail client with the attachments pre-populated with .NET? Maybe another MAPI wrapper, but one with a VERY lenient license?


Solution

  • A .NET mapi wrapper is indeed the best solution - there are many results returned for a google of "mapi .net wrapper", I am sure one of these will have a suitable license: