• Rules >
  • Amazon SES Service Rules

Amazon SES Service Rules

To use the Amazon SES Service, you must specify rules to enable its actions. The rule must evaluate to true for the action to be enabled. Actions can be configured to be always enabled by specifying an empty document for your rule, {} , which evaluates to true.

Service Configuration

Before applying service rules, you must set up the Amazon SES service in AWS and add it to your MongoDB Stitch application. For instructions on setting up your Amazon SES service, see Amazon SES.

Specify a Rule

  1. Select the Amazon SES service from the Services section on the left side navigation.

  2. Click the Rules tab, then click the Add Rule button.

  3. Toggle the action(s) for which the rule applies.

  4. Specify a rule in valid JSON that evaluates to a boolean. The following are permitted in the rule document:

      <field1>: <value1|expression1>,
      <field2>: <value2|expression2>,

SES Service Arguments

To specify a rule based on arguments:

  "%%args.<argument1>": <value1|expression1>,
  "%%args.<argument2>": <value1|expression2>,

Or, you can omit the %%args prefix if you do not specify any expansion prefixes for the fields.

  "<argument1>": <value1|expression1>,
  "<argument2>": <value1|expression2>,

However, you cannot mix arguments with prefixes and arguments without prefixes in the same rule. For example, the following rule is invalid:

  "": "",
  "from": "",

The following arguments are permitted in SES service rules:

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 constant. For more information on defining constants, see Values.