Azure Email Communication Service
Azure Email Communcation Service provider for Strapi
Strapi Email provider for Azure Communication Service
Installation
# using yarn
yarn add strapi-provider-email-azure
# using npm
npm install strapi-provider-email-azure --save
Then in your config/plugins.js
:
1module.exports = ({ env }) => ({
2 // ...
3 email: {
4 config: {
5 provider: 'strapi-provider-email-azure',
6 providerOptions: {
7 endpoint: env('AZURE_ENDPOINT'),
8 },
9 settings: {
10 defaultFrom: env('FALLBACK_EMAIL'),
11 },
12 },
13 },
14 // ...
15});
Usage
1await strapi
2 .plugin('email')
3 .service('email')
4 .send({
5 from: process.env.EMAIL_SERVICE_ADDRESS,
6 to: [
7 {
8 address: 'recipent@email.address',
9 displayName: 'Display Name',
10 },
11 ],
12 subject: 'Hello world',
13 text: 'Hello world',
14 });
You can also leave the from
field empty to send the email from the fallback address.
The following fields are supported:
Field | Description |
---|---|
from | Email address of the sender (string) |
to | Array of recipients (string | EmailAddress | Array\ |
cc | Array of recipients who get cc (string | EmailAddress | Array\ |
bcc | Array of recipients who get bcc (string | EmailAddress | Array\ |
replyTo | Email address to which replies are sent (Array\ |
subject | Subject of the email (string) |
text | Plaintext version of the message (string) |
html | HTML version of the message (string) |
attachments | Array of attachments (Array\ |
disableUserEngagementTracking | Whether user engagement tracking should be disabled (boolean) |
headers | Custom email headers (Dictionary<string, string>) |
1type EmailAddress {
2 address: string,
3 displayName: string
4}
5type Attachment {
6 name: string,
7 contentType: string,
8 contentInBase64: string
9}
For more information, please refer to @azure/communication-email documentations:
How to create Azure Communication Service
1. Create the Email Communications Service
- Navigate to the Azure portal to create a new resource
- Create Email Communication Services
- Complete the required information on the basics tab
- Review the resource details. Click Create
- Wait for the Deployment to complete
2. Create Communication Service
- Navigate to the Azure portal to create a new resource
- Create Communication Services
- Complete the required information on the basics tab
- Review the resource details. Click Create
- Wait for the Deployment to complete
3. Connect the services
- Go to your newly created Email Communcation Services resource, and navigate to Provision Domains
- Add a new Azure managed domain or Custom domain
- Go to your Communication Services resource, and navigate to Email/Domains
- Connect to the domain you created in you Email Communication Services resource
4. Acquire access endpoint key
- In your Communication Services resource, navigate to Settings/Keys
- Copy your Primary key/Connection string
- Store it in your environment variables\
AZURE_ENDPOINT=<connection_string>
5. (Optional) Create email addresses
- In your Email Communication Services resource, go to Provision Domains, and click on the name of your domain
- In Email services/MailFrom addresses you can create additional email addresses
- By default DoNotReply@yourdomain is created, and you can store it as the fallback email address of
strapi-provider-email-azure
in your environment variables\FALLBACK_EMAIL=DoNotReply@yourdomain
Install now
npm install strapi-provider-email-azure
Create your own plugin
Check out the available plugin resources that will help you to develop your plugin or provider and get it listed on the marketplace.