Skip to content

Commit

Permalink
feat(Email): Adds configuration for Strapi's email service
Browse files Browse the repository at this point in the history
  • Loading branch information
KevSanchez committed Nov 25, 2024
1 parent afa0d1c commit 77e1b7c
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
18 changes: 17 additions & 1 deletion cms/config/plugins.ts
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
export default () => ({});
export default ({env}) => ({
email: {
config: {
provider: 'amazon-ses',
providerOptions: {
key: env('AWS_SES_ACCESS_KEY_ID'),
secret: env('AWS_SES_ACCESS_KEY_SECRET'),
amazon: `https://email.${env('AWS_REGION')}.amazonaws.com`
},
settings: {
defaultFrom: `strapi@${env('AWS_SES_DOMAIN')}`,
defaultReplyTo: `strapi@${env('AWS_SES_DOMAIN')}`,
},
},
}

});
1 change: 1 addition & 0 deletions cms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"@strapi/plugin-documentation": "4.25.13",
"@strapi/plugin-i18n": "4.25.13",
"@strapi/plugin-users-permissions": "4.25.13",
"@strapi/provider-email-amazon-ses": "5.1.1",
"@strapi/strapi": "4.25.13",
"pg": "8.8.0",
"react": "^18.0.0",
Expand Down
13 changes: 13 additions & 0 deletions infrastructure/base/modules/email/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,23 @@ resource "aws_ses_domain_identity" "domain_identity" {
domain = var.domain
}

// This represents a completed email identity verification, so it must be uncommented once
// it's been completed
resource "aws_ses_domain_identity_verification" "domain_identity_verification" {
domain = aws_ses_domain_identity.domain_identity.id
}

resource "aws_ses_domain_dkim" "domain_dkim" {
domain = aws_ses_domain_identity.domain_identity.domain
}

resource "aws_ses_configuration_set" "email_configuration_set" {
name = "${var.project}-email-config-set"
}
// MISSING: currently the resource to assign a configuration set to an identity seems to be available
//only in aws_ses_v2, so it needs to be done manually on the console, or be forced to recreate all ses resources

//Permissions
resource "aws_iam_user" "email_sender_user" {
name = "${replace(title(replace(var.domain, "/\\W/", " ")), " ","")}EmailSender"
}
Expand Down

0 comments on commit 77e1b7c

Please sign in to comment.