Emailing via Azure in .NET Core 2.0


How to send emails in .NET Core using Azure SendGrid service.


Create a class library and add NuGet package:  Sendgrid

Add a class to encapsulate 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 functionality of sending email messages:

To use the above class:

Note: the sample code includes the builder for email message


The sample code will require you to setup Azure account and SendGrid account. Instructions for these could be found at:

You’ll also need API Key, which can be created at: using your Azure SendGrid username and password. More details can be found at:

Source Code


Leave a Reply