SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to send e-mail from an InfoPath (2007/2010) form (InfoPath client, NOT web hosted). I found two ways that look promising:

  1. using System.Web.Mail.MailMessage class (
  2. using Microsoft.Office.Interop.Outlook.MailItem

    Application application = new ApplicationClass(); application.GetNamespace("MAPI"); MailItem mailItem = (MailItem)application.CreateItem(OlItemType.olMailItem); mailItem.Subject = subject; // ... mailItem.Send();

What is the way to go and why?

share|improve this question
up vote 2 down vote accepted

The Office Outlook Interop assumes Outlook is installed and configured on the client, the System.Web.MailMessage does not, but was designed to be used from server web applications.

share|improve this answer
So, if the form is browser hostet, I should use the first approach, and if it is hosted in InfoPath client, I should go with the second? Is there a way to be independent from the fact, where the form is hosted? – Hinek Jul 21 '11 at 9:24
Unless you are certain that your users are actively using Outlook on the desktop avoid using the Interop assemblies. System.Web.Mail is fine to use server or desktop, but has some potential issues with legacy OS (XP, Windows Server 2003) due to dependencies - most of the time it should work fine. – Chris Beckett Jul 21 '11 at 15:47
Thanks, that clarified it for me. – Hinek Jul 25 '11 at 6:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.