Home > Blockchain >  C# open outlook mail window
C# open outlook mail window

Time:02-14

I have a simple application written in C # .net 6.0. After pressing the button, I would like to open an Outlook window with the content of the e-mail from the textbox and the recipient from the textbox.

The problem is that the application is used on computers in the corporate domain. I cannot send emails programmatically using smtp.

Mail must be banned exactly from the account of the person who is currently logged on to the computer (window 10), who has his Outlook account configured so that it is assigned to a windows account.

I tried to use Microsoft.Office.Interop.Outlook but I get an error

Could not load file or assembly 'Microsoft.Office.Interop.Outlook, Version = 15.0.0.0, Culture = neutral, PublicKeyToken = 71e9bce111e9429c

CodePudding user response:

I tried to use Microsoft.Office.Interop.Outlook but I get an error

You need to add a COM reference to the project. Right click on the dependencies of your project and choose Add COM references:

COM references VS2022

In the dialog window you can find the entry for Outlook and select it.

Outlook COM reference

Viola! Click the Ok button and use the OOM in your code.

CodePudding user response:

Add Microsoft.Office.Interop.Outlook via NuGet. This will resolve your error and provide a programmable way to interact with Outlook.

Install-Package Microsoft.Office.Interop.Outlook
  • Related