Skip to main content

AWS SES

Profile Requirements

To deliver a message to a recipient over AWS SES, Courier must be provided the recipient's email address. This value should be included in the recipient profile as email.

// Recipient Profile
{
"email": "example@example.com"
}

Configuring AWS SES

To deliver a message, Courier requires an Access Key ID and Secret Access Key of an IAM user. That user needs to be able to perform SES SendEmail Action on the identity or identities ARNs of the recipient(s). See creating a new IAM user and Programmatic access Documentation to get started.

Attach the Built-in Policy

When creating a new IAM user, you can attach the AmazonSESFullAccess built-in policy to grant the IAM user full access to sending emails to any identity on the AWS account.

Create and Attach a Custom Policy

Here is an example of an IAM user with the policy required where they can perform send email against all SES identities:

{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": ["ses:SendRawEmail", "ses:GetSendStatistics"],
"Resource": "*"
}
]
}

Override

Overrides can be used to change the RawMessage & Source and that Courier uses to send an email and to add attachments. Overrides in SES are useful if you have a MIME 1.0 string to pass instead of the template created in Courier. You can override any of the fields supported by AWS SES's SendRawEmail method (see all request body fields here). Below is an example of overriding the Data off of RawMessage:

{
"event": "<COURIER_NOTIFICATION_ID>",
"recipient": "katherine_pryde",
"profile": {
"email": "kpryde@xavierinstitute.edu"
},
"data": {
"name": "Katherine Pryde"
},
"override": {
"aws-ses": {
"body": {
"RawMessage": {
"Data": "<Mime 1.0 compatible message>"
}
}
},
"config": {
"accessKeyId": "<Access Key ID>",
"secretAccessKey": "<Secret Access Key>"
}
}
}

Sending Attachments

To include an attachment in the email, you can use the following override:

{
"event": "<COURIER_NOTIFICATION_ID>",
"recipient": "katherine_pryde",
"profile": {
"email": "kpryde@xavierinstitute.edu"
},
"data": {
"name": "Katherine Pryde"
},
"override": {
"aws-ses": {
"attachments": [
{
"filename": "hello.txt",
"contentType": "text/plain",
"data": "SGk="
}
]
}
}
}