Integration with SendGrid

SendGrid is one of the most popular services for delivering the email messages. It allows sending both, the regular, plain text email messages as well as the templated ones (called “transactional”). On top of that, it has also some other cool features such as marketing templates. In this post, I’m going to describe the way that the Warden project has been integrated with this service.


As every other plugin, the SendGrid integration is a available as a NuGet package:

So what it does? As the name states, it integrates the Warden instance with the SendGrid service in order to easily send the email messages e.g. about some resource failure that has just become unavailable. The configuration per se is pretty straightforward, just take a look:

All you need to do, is to call the the available extension method IntegrateWithSendGrid(), where you can either pass the API key or credentials (username and password).
Once it’s done, you can use another extension method available via the integration, which is simply called SendEmailAsync().
Actually, it’s more than just this single method – there are available its overloads as well as the another function name SendTemplatedEmailAsync() which allows to make use of the transactional templates.

There are also additional options that you can use to reduce the amount of the same code while sending emails e.g. WithDefaultTemplateId(), WithHtmlBody() or even the WithEmailSenderProvider() if you would like to control the way that the email messages are being sent.

I’ve implemented this functionality to make it simpler to get notified whenever something wrong happens to the resources being monitored by the Warden.
Given the fact that the SendGrid can be used for free (10k messages per month), I do not find any reason not to try it out ;).

1 Comment Integration with SendGrid

  1. Dai Software

    Hey, very nice site. I came across this on Google, and I am stoked that I did. I will definitely be coming back here more often. Wish I could add to the conversation and bring a bit more to the table, but am just taking in as much info as I can at the moment. Thanks for sharing.
    Dai Software
    Keep Posting:)


Leave A Comment

Your email address will not be published. Required fields are marked *