vineet sharma

vineet sharma

  • NA
  • 22
  • 21.9k

how to add sender details while sending message 2 outlook

Apr 1 2014 2:47 AM
how to add sender details(email id) while sending an email to receivers id having outlook id .here is my code


using lookout = Microsoft.Office.Interop.Outlook;
using outlookapp = Microsoft.Office.Interop.Outlook.Application;
using mapiNamespace = Microsoft.Office.Interop.Outlook.NameSpace;
using CalendarFolder = Microsoft.Office.Interop.Outlook.MAPIFolder;
using outlookCalendarItems = Microsoft.Office.Interop.Outlook.Items;
using outlookrecepient = Microsoft.Office.Interop.Outlook.Recipient;
using outlookrecepients = Microsoft.Office.Interop.Outlook.Recipients;



 outlookapp outlook = new outlookapp();
            MailItem mailItem = (MailItem)outlook.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);
            mailItem.To = oulookid;
            mailItem.Subject = "LEAVE GRANTED FROM " + startdate + "to" + enddate;
            mailItem.Body = "ENJOY THE HOLIDAYS";
            mailItem.Importance = OlImportance.olImportanceHigh;
           mailItem.Sender =  /* what to write*/          
            mailItem.Send();
thanks in advance