Full Source Code The source code for the app can be found on GitHub
This blog post is part of a series on how to generate a weekly digest email for a blog using Azure Functions, SendGrid and Azure Storage.
While reading a blog post, one of these popped up:
We've all seen then before, and I must admit that I've never really looked into it before I started writing this Azure Tips and Tricks series.
We're all crazy busy, so it seems to be a good idea, for someone to give you an email address and be notified of new posts. OK, so I wanted to do it, and started looking into sites that offer this. After looking around, I kept finding this:
Most companies offer you a certain number of subscribers for free, then you'll quickly get to a paid version once you go over that number.
Since I like to save a penny now and again and am aware that I have more subscribers that the free account offers (200), I decided to roll my own. But what would I need?
My requirements for my version of creating an email subscription is the following:
After poking around for a bit, I landed on the following:
Go to the Azure Portal and search services for SendGrid and create an account as shown below. You'll notice that I used the Free account as it is good enough for what I was trying to accomplish.
Go to your SendGrid account once provisioned and click on Manage and it will bring you to https://app.sendgrid.com/. From the SendGrid portal, you are going to want to grab your API key. You can find it under Settings, then API Keys. Give your API Key a name and then give it Full Access and click Create and View. Now that you have your API Key, save it somewhere safe.
Go back to the Azure Portal and click Create a Resource and select Azure Storage. We'll keep it simple as shown below to get started.
Once complete, go into the resource and look under Services.
Go ahead and click on Tables and you could create a new table through the portal as shown below.
Go ahead and give the table a name that you'll remember and look under Settings, then Access Keys and copy the connection string as we'll use that shortly.
Now that we have our SendGrid account and our Azure Storage Table created. We can proceed.
Create a C# Azure Function application by opening Visual Studio and selecting the template under the Cloud node as shown below:
Under Storage, change the default emulator to the Azure Storage Account that we created earlier:
We'll begin by using the Timer Trigger and leaving everything as the defaults.
Once the project spins up, we'll use NuGet to pull in references to :
To work with Azure Table Storage.
To hide our API keys
To send our emails
To work with RSS feeds - use prerelease packages to find it