You must Sign In to post a response.
  • Category: ASP.NET

    80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).

    Hello friends,
    I am trying to send mail from outlook to gmail from c# code.The code is as follows.

    Application OutlookApplication = new Application();
    MailItem message = (MailItem)OutlookApplication.CreateItem(OlItemType.olMailItem);
    Microsoft.Office.Interop.Outlook.Accounts accounts = message.Session.Accounts;
    foreach (Microsoft.Office.Interop.Outlook.Account account in accounts)

    string _emailID = account.SmtpAddress;
    if (account.SmtpAddress == _emailID)
    message.SendUsingAccount = account;
    MailAddress toAddress = new MailAddress(txtto.Text.Trim());
    message.To = toAddress.ToString();
    message.Subject = txtsubject.Text;
    message.Body = txtmessage.Text;
    message.BodyFormat = OlBodyFormat.olFormatHTML;
    // ((Microsoft.Office.Interop.Outlook._MailItem)message).Send();

    once I am trying to run this code on server. I am encountered with following error.

    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)).

    Please help me to resolve the issue

  • #761280

    You can go through Below link for Resolved this issue it may be helpful to you

    Name : Dotnet Developer-2015
    Email Id

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.

  • #761282
    Hai Navneet,
    This is common issue which can occur due to various reasons:
    1. The COM component(for the outlook) is not registered to the current system in Win32 folder.
    2. The COM component is not accessible due to the current user permission level.
    3. The COM component is not matching with the windows version. COM components are different for 32 and 64 bit machines.
    So you need to check all these things to resolve the issue.
    Hope it will be helpful to you.

    Pawan Awasthi(DNS MVM)
    +91 8123489140 (whatsApp), +60 14365 1476(Malaysia)

Sign In to post your comments