'WCF Service Send Email On Outlook | Exception from HRESULT
I have created a WCF Project in .NET 4.5 to send emails from Outlook 2013 Or 2016 and host it on windows server 2012 and iis 8.
When run Service from Visual studio 2019 in windows 10 everything works as expected but when deployed to:
- IIS 8 in windows server 2012
...the following error happens:
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)). at Service.Method
I also did DCOM Config that I found solution from other posts but still I have same problem.
i want attach meeting and reminder in email , for this i used outlook .(outlook connected to Exchange) . if there is other way please say it.
Solution 1:[1]
No Office app, Outlook included, can be used from a Windows service. Extended MAPI (C++ or Outlook) can be, but that means a profile would either need to be manually configured first, or you would need to programmatically build it first. In case of C#, you can use the RDO family of objects in Redemption (I am its author - it wraps the Extended MAPI system).
If you are only sending messages, why not use straight SMTP? If you are sending through an Exchange Server, why not use EWS (whcih has a .Net wrapper)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |