Send email using Netoffice ASP MVC

Asked

Viewed 154 times

1

I am starting to send emails in my application, so I am trying to use the package of Netoffice to send and receive emails. What I am trying to do is: From the account logged in to the local pc with the Outlook application, send an email with a preset message in my application.

At first I’m having problems... I’m following a example of Netoffice where it gives me errors, where when making the import of the package (using NetOffice;), gives errors to start Outlook (Outlook.Application outlookApplication = new Outlook.Application();).

Another small question: There are Packages or better alternatives to Netoffice?

  • What’s the problem? You can enter the code?

  • The only code I put in was to start outlook (Outlook.Application outlookApplication = new Outlook.Application();)

1 answer

1

Download Package from Visual Studio’s Nuget and bring to your project the necessary dependencies by following the steps:

Menu: TOOLS -> Nuget Package Manager -> Manage Nuget Packages For Solution inserir a descrição da imagem aqui

Then with it open do research (netoffice.outlook): inserir a descrição da imagem aqui Note: Choose the version corresponding to your Framework in my case was 4.5, the description already speaks for you (2.0, 3.0, 3.5, 4.0 and 4.5)

After successfully installing the encoding in your project would be like this:

NetOffice.OutlookApi._Application app = new NetOffice.OutlookApi._Application();            
app.Session.SendAndReceive(true);

A cool tip is to always use the Nuget where possible, therefore, it solves dependencies. A good read on the subject matter, and on this website.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.