Emailing Via Azure In .NET Core 2.0

In this article, we will learn how to send emails in .NET Core using Azure SendGrid service.
 
Solution

Create a class library and add NuGet package - Sendgrid

Add a class to encapsulate the settings and server response:

Add a class to encapsulate an email message (see also the previous post on builder pattern).

Add a class to wrap the functionality of sending email messages.

To use the above class,

NoteThe sample code includes the builder for email message.

Discussion

The sample code will require you to set up Azure account and SendGrid account. Instructions for these can be found here. You’ll also need API Key, which can be created here, using your Azure SendGrid username and password. More details can be found here.

Source Code

GitHub