Skip to main content
Azure

.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 6.

Christian Schou

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