Amazon SES Service

Amazon SES is a component of Amazon Web Services which provides a way to send and receive email in response to events in your app. To use it, 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

  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 SES Service to Your App

  1. If you don’t have a MongoDB Stitch app set up yet, see Getting Started.
  2. If your app doesn’t have an SES service yet, click Add Service in the left side navigation.
  3. Select SES.
  4. Enter a name for your service in the Service Name box.
  5. Enter your AWS credentials. Make sure the region matches the region your AWS user is registered with.
  6. Click Add Service.

Functions and Amazon SES Service

MongoDB Stitch provides the ability to define a sequence of actions to perform as a function. For the Amazon SES service, MongoDB Stitch provides the following actions:

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

Test Your Address in a Function

  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() {
       var ses ="my-ses-service");
          "toAddress": "",
          "body": "test message",
          "fromAddress": "",
          "subject": "test subject"
  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.