May 09, 2016 by Anuraj Estimated read time : 2 mins
This post is about sending emails from ASP.NET Core using MailKit nuget package. In ASP.NET Github repository, there was one issue (1006) for Add SmtpClient support in ASPNET Core. And there was some implementation, which uses TcpClient to send email from ASP.NET Core. But this implementation is using MailKit nuget package. It is from Jeffrey Stedfast, and licensed under MIT.
So first you need to include MailKit nuget package in your project.json. It is supported in both dnx451 and dnxcore50 frameworks. Here is my project.json file.
Next you need to write code to send mail, plain text.
For HTML mails you need to use BodyBuilder class and set the HtmlBody property like this.