Email Sample Advanced
This sample sends an email to the selected recipients of any domain using an Email Communication Services resource.
Additional documentation for this sample can be found on Microsoft Docs.
Prerequisites
- Create an Azure account with an active subscription. For details, see Create an account for free.
- Visual Studio (2019 and above).
- .NET 6.0 (Make sure to install version that corresponds with your Visual Studio instance, 32 vs 64 bit).
- Create an Azure Communication Services resource. For details, see Create an Azure Communication Resource. You will need to record your resource connection string for this sample.
- Create an Azure Email Communication Services resource to start sending emails.
Note: We can send an email from our own verified domain also Add custom verified domains to Email Communication Service.
Code structure
- ./SendEmailPlainText/Program.cs: Entry point for sending plain text email.
- ./SendEmailWithAttachments/Program.cs: Entry point for sending email with attachments.
- ./SendEmailWithInlineAttachments/Program.cs: Entry point for sending email with inline attachments.
- ./SendEmailWithManualPollingForStatus/Program.cs: Entry point for sending emails and manually poll for the email send status.
- ./SendHighImportanceEmailToMultipleRecipients/Program.cs: Entry point for sending high importance email to multiple recipients.
- ./SendEmailWithManagedIdentity/SendEmailWithManagedIdentityFunction.cs: Entry point for sending an email using a function app with a managed identity.
- ./SendBulkEmailWithOptionalThrottlingPolicy/Program.cs: Entry point for sending bulk emails with optional throttling policy.
- ./SendEmailWithManualPollingUsingOperationId/Program.cs: Entry point for sending an email and polling for status using operationID to rehydrated email send operation.
Before running the sample for the first time
- Open an instance of PowerShell, Windows Terminal, Command Prompt or equivalent program and navigate to the directory that you would like to clone the sample to.
git clone https://github.com/Azure-Samples/communication-services-dotnet-quickstarts.git
Locally configuring the application
Navigate to the SendEmailAdvanced folder and open the
SendMailAdvanced.sln
solution in Visual Studio.Open the program.cs file of each project in code structure to configure the following settings:
connectionString
: Replace<ACS_CONNECTION_STRING>
with Azure Communication Service resource's connection string.sender
: Replace<SENDER_EMAIL>
with the sender email obtained from Azure Communication Service.recipient
: Replace<RECIPIENT_EMAIL>
with the recipient email.
Run respective project.
❤️ Feedback
We appreciate your feedback and energy in helping us improve our services. Please let us know if you are satisfied with ACS through this survey.