Share via

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

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

  1. 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.
  2. git clone https://github.com/Azure-Samples/communication-services-dotnet-quickstarts.git

Locally configuring the application

  1. Navigate to the SendEmailAdvanced folder and open the SendMailAdvanced.sln solution in Visual Studio.

  2. 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.
  3. 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.