简体   繁体   中英

C# open outlook mail window

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

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

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 引用 VS2022

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

Outlook COM 参考

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM