0
Answer

how to add sender details while sending message 2 outlook

vineet sharma

vineet sharma

10y
763
1
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