Amazon SES Service


This service has been deprecated and replaced with the more general AWS Service. This documentation is provided solely to support existing Stitch apps.

Amazon SES is a component of Amazon Web Services which provides a way to send and receive email.

To use the Amazon SES Service in MongoDB Stitch, you need:

  • A MongoDB Stitch app with at least one user.
  • An Amazon AWS account with permission to use the SES service.
  • At least one verified email address.

Set up SES in AWS

  1. Log in at the Amazon AWS console.

    Amazon recommends that you set up an IAM (Identity and Access Management) user for running AWS services, rather than running services as your root AWS user, and grant that user only the permissions necessary to run the services you need. See Amazon’s documentation for more information about IAM users.

  2. Navigate to the SES dashboard through the Services menu in the top left of the AWS console.

  3. Verify at least one email address in the Email Addresses area.

Add an Amazon SES Service

To set up an Amazon SES service in MongoDB Stitch:

  1. Click Services in the left navigation pane and click Add a Service.
  2. Select SES.
  3. Enter a name for your service in the Service Name box.
  4. Enter your AWS credentials. Make sure the region matches the region your AWS user is registered with.
  5. Click Add Service.

Service Actions

The Amazon SES service in MongoDB Stitch provides the following actions which are available in functions and in the SDKs:

Action Description
sesService.send() Sends an email message to a specified address.


  1. In the MongoDB Stitch admin console, click Functions in the left side navigation and then Create New Function.

  2. Give the function the name ses_test.

  3. In the Function Editor add the following code. This example assumes that the SES service has the name "my-ses-service".

    exports = function() {
       const ses ="my-ses-service");
       return ses
           "toAddress": "",
           "body": "test message",
           "fromAddress": "",
           "subject": "test subject please ignore"
         .then(({ messageId }) => `sent email with id: ${messageId}`)
  4. Using the debug Console below the Function Editor execute the function with:

  5. Check the recipient’s inbox.


    The message is sent by Amazon SES. Depending on your email provider’s policies and your SES setup, the message’s From address may not match the sender’s identity. Check your junk mail folder if you don’t see the message in your inbox.

Service Rules

You must specify rules to enable the SES send action. A rule must evaluate to true to enable the action.

The following arguments are permitted in SES service rules, and they can be accessed with the "%%args" expansion:

Field Type Description
toAddress String The destination email address.
fromAddress String The email address from which the message originates.
subject String The subject of the message.
body String The body of the message.


Actions When
  "fromAddress" : "",
  "toAddress": { "%in": "%%values.opt-ins" }

The rule ensures that applications can only perform a send action when:

  • fromAddress is, and
  • toAddress is an email listed in the opt-ins array, where opt-ins is a user-defined value.