Click here to Skip to main content
15,885,869 members
Please Sign up or sign in to vote.
3.67/5 (2 votes)
Hi,
I am using Microsoft.Office.Interop.Outlook to send emails from a C# application since SMTPClient is not allowed in my organization to send emails.When i run this in my local machine,it is working fine.But when i hosted the application in the server,it is giving error "Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005". please see the code snippet below which I have used.

C#
         using Outlook = Microsoft.Office.Interop.Outlook;
                 .
                 .
                 .

    string HTMLBody = "";
    Outlook.Application oApp = new Outlook.Application()
      // Get the NameSpace and Logon information.
     Outlook.NameSpace oNS = oApp.GetNamespace("mapi");
      // Log on by using a dialog box to choose the profile.
      oNS.Logon(Missing.Value, Missing.Value, true, true);
      // Create a new mail item.
      Outlook.MailItem mail = (Outlook.MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem);
 HTMLBody = File.ReadAllText("D:\\TLDR_VacationPlanner\\Email emplates\\VacationTemplate.html");
             mail.To = strEmail;
mail.HTMLBody = HTMLBody;
 mail.Send();

oNS.Logoff();
           //oRecip = null;
           mail = null;
           oNS = null;
           oApp = null;


I have copied and registered the dlls in the server using Regasm.Please advise.

Thanks.
Posted
Updated 26-May-14 9:26am
v2
Comments
[no name] 26-May-14 16:31pm    
The most likely reason is that the user account trying to run your application does not have the necessary rights to the registry.
Member 3521466 28-May-14 11:30am    
Hi,
Thanks for your reply.I gave full permissions for the asp.net account which is running the application to the DCOM components "OutLook Message Attachments" and "Outlook Office Finder" in the registry.But I was unable to find a DCOM compnent with Id "0006F03A-0000-0000-C000-000000000046".Any suggestion what could be the issue?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900