title: Changing outlook mail sender in C# using Microsoft.Office.Interop.Outlook.Mailitem
body: <p>I programmed a wpf application that sends an outlook mail through the default logged in user.</p>
  
  <p>This is my code:</p>
  
  <pre><code>using System;
  using System.Configuration;
  using System.IO;
  using System.Net;
  using System.Net.Mail;
  using System.Runtime.InteropServices;
  using Outlook = Microsoft.Office.Interop.Outlook;
  using Office = Microsoft.Office.Core;
  
  namespace FileOrganizer
  {
      class Program
      {
          private void CreateMailItem()
          {
              Microsoft.Office.Interop.Outlook.Application app = new Microsoft.Office.Interop.Outlook.Application();
              Microsoft.Office.Interop.Outlook.MailItem mailItem = app.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);
              mailItem.Subject = "This is the subject";
              mailItem.To = "someone@example.com";
              mailItem.Body = "This is the message.";
              mailItem.Attachment.Add(logPath);//logPath is a string holding path to the log.txt file
              mailItem.Importance = Microsoft.Office.Tools.Outlook.OlImportance.olImportanceHigh;
              mailItem.Display(false);
          }
      }
  }
  </code></pre>
  
  <p>I saw this post:</p>
  
  <p><a href="https://stackoverflow.com/questions/11223462/how-to-send-a-mail-using-microsoft-office-interop-outlook-mailitem-by-specifying">How to send a mail using Microsoft.Office.Interop.Outlook.MailItem by specifying the From Address</a></p>
  
  <p>But i can't find the Outlook.Accounts option in my project. It just doesn't appear.</p>
  
  <p>Does anyone have a solution for this problem?</p>
  
  <p>My main goal of course is to send my mail using different user.</p>