.NET - Send emails using Azure Communication Services

Azure is offering a dedicated communication service to send emails on a large scale. This tutorial will walk you through sending thousands of emails using Azure Communication Services with .NET.

In one of my earlier .NET tutorials, I showed you how to send emails using Microsoft Graph in .NET. You can read the article/tutorial at the link below. It will show you a way to send emails using the Microsoft Graph API as an alternative to the deprecated SmtpClient by Microsoft.

How to send emails using Microsoft Graph API in .NET
Learn how to send emails using Microsoft Graph API in .NET 6 + 7 as a background service using App Registration with Modern Authentication.

Microsoft Graph is working perfectly and it's free at the same time for all organizations using Office 365. The only problem you could encounter is the sending limit. Microsoft Graph only allows for sending 10.000 emails a day. This could be a problem for many organizations that would like to send newsletters, notifications, etc... To solve this problem Azure made a solution, it's named Azure Communication Services.

Azure Communication Services – Communication APIs | Microsoft Azure
Build engaging communication services and experiences with communication APIs, SMS APIs, and video APIs and technology as used by Microsoft Teams.
🚧
GDPR - The email service at Azure Communication Services is currently only available in preview (as of writing 05/01-23). If you plan on sending out emails to customers in Europe, please be aware that the only available data location is within the United States.

If you are ready, then let's configure a new service in Azure to send emails on a large scale using Azure Communication Services with .NET.

Step #1 - Azure

Configuration of Azure Email Communication Services

Login to Azure Portal

Configure Azure

The first thing, we have to do is create a new Email Communication Service through the Azure Portal. You can do this by opening up your Azure Marketplace and searching for "Email Communication Services". Click on "Create Email Communication Service".

Create Email Communication Service
Create Email Communication Service

Fill out the required details for your resource, as I have done below, just with your own details:

Create new Azure Resource, azure, create resource, email service
Create a new Azure Resource

It will only take a few minutes for Azure to deploy your service. When it's ready to use, click it and configure a sender domain for the service. This is done under Provision domains -> Add domain -> Custom domain, as shown below:

azure, add custom domain, provision domain, add sender domain azure
Provision Custom Sender domain

Continue reading for free

Sign up to read this post and all other free TWC member only posts. Yes it's totally free and I promise no spam! You can unsubscribe or modify what kind of notifications you get from me at any time.
You've successfully subscribed to Tech with Christian
Great! Next, complete checkout to get full access to all premium content.
Error! Could not sign up. invalid link.
Welcome back! You've successfully signed in.
Error! Could not sign in. Please try again.
Success! Your account is fully activated, you now have access to all content.
Error! Stripe checkout failed.
Success! Your billing info is updated.
Error! Billing info update failed.