Email Sample

Overview

This is a sample email application to show how we can use the @azure/communication-email package to build an email experience. This sample sends an email to the selected recipients of any domain using an Email Communication Services resource. This is a console application built using Node.js 14.

Additional documentation for this sample can be found on Microsoft Docs.

Prerequisites

Note: We can also send an email from our own verified domain. Add custom verified domains to Email Communication Service.

Prerequisite check

  • To view the domains verified with your Email Communication Services resource, sign in to the Azure portal. Locate your Email Communication Services resource and open the Provision domains tab from the left navigation pane.

Code structure

  • ./send-email/package.json: Package file
  • ./send-email/send-email.js: Entry point into the email sample

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'd like to clone the sample to.
  2. git clone https://github.com/Azure-Samples/communication-services-javascript-quickstarts.git

Locally configuring the application

Open the send-email.js file to configure the following settings:

  • connectionString: Replace <ACS_CONNECTION_STRING> with the connection string found within the 'Keys' blade of the Azure Communication Service resource.
  • senderAddress: Replace <SENDER_EMAIL_ADDRESS> with the sender email address obtained from the linked domain resource.
  • recipientAddress: Replace <RECIPIENT_EMAIL_ADDRESS> with the recipient email address.

Local run

  • npm install from the root directory.
  • npm start from the root directory.

❤️ 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.