DEV Community

Cover image for How to setup AWS SES email provider in your Strapi app
kevinadhiguna
kevinadhiguna

Posted on • Edited on

How to setup AWS SES email provider in your Strapi app

When you forgot password and want to reset it, you usually get an email that contains a link to your application. Then it will redirect you to a page where you can create a new password. An operation like this requires an email provider, such as AWS Simple Email Service (SES).

In this article, we will learn how to setup AWS SES email provider in your Strapi app.

Prerequisites :

Step 1 : Install Strapi AWS S3 upload provider
Open your terminal, then run :
yarn add strapi-provider-email-amazon-ses
or
npm i strapi-provider-email-amazon-ses --save

Check your package.json if strapi-provider-email-amazon-ses exists. If so, you have successfully installed Strapi AWS SES email provider.

Step 2 : Create plugins.js in config directory
PATH : ./config/plugins.js

module.exports = ({ env }) => ({
 email: {
   provider: 'amazon-ses',
   providerOptions: {
     key: env('AWS_ACCESS_KEY_ID'),
     secret: env('AWS_SECRET_ACCESS_KEY'),
     amazon: `https://email.${env('AWS_REGION')}.amazonaws.com`
   },
   settings: {
     defaultFrom: env('EMAIL_DEFAULT_FROM'),
     defaultReplyTo: env('EMAIL_DEFAULT_REPLY_TO')
   }
 },
}
Enter fullscreen mode Exit fullscreen mode

Configuration
Alt Text

Learn more how to configure Strapi AWS SES email provider

Step 3 : Fill in environment variables
In ./config/plugins.js above, we assigned a lot of environment variables. Now it’s time to fill them in.
PATH : .env (root directory of your Strapi app)
Alt Text

It is not mandatory to include defaultFrom (EMAIL_DEFAULT_FROM) and defaultReplyTo (EMAIL_DEFAULT_REPLYTO) in environment variables but optional.

How do I gain my AWS security credentials ?
Simply sign in to the AWS management console, then open the dropdown menu. Select My Security Credentials.
Alt Text

After that you will see a page like this :
Alt Text

Learn more how to gain your AWS security credentials.

Hooray! It’s time to start your Strapi app and make sure it works. Thanks for reading, hope you have a great day today!

Connect with me :
LinkedIn - kevinadhiguna
Github - kevinadhiguna

References :

Top comments (1)

Collapse
 
armanap profile image
Arman AP

It should be noted that its best practice to not use your ROOT aws credentials but rather create IAM accounts with specific privileges.