I am trying to Compose email from the server side. I have Microsoft.office.core and Microsoft.Office.Interop.outlook reference installed and am using this code below. This Code work great for new email(outlook) in my Local Machine. but when i try to publish my website to the Dev/Test server this code does not work and i get this error irrespective i have outlook installed in both the servers
System.UnauthorizedAccessException:
Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
How to solve it. Any help is good..Thanks in Advance
Outlook.Application outlookApp = new Outlook.Application();
Outlook.MailItem mailItem = (Outlook.MailItem)outlookApp.CreateItem(Outlook.OlItemType.olMailItem);
mailItem.Subject = "Notice to Proceed MnDOT Contract Number: " + CntrctID;
mailItem.To = lstCntrctContractorContact[0].CNTRCTR_PROJ_Email;
mailItem.CC = CntrctContactInfo.MnDot_EMAIL;
mailItem.HTMLBody = EmailBodyMsg.ToString();
mailItem.Display(false);