

# Receiving Amazon SES notifications using Amazon SNS
Receive notifications using Amazon SNS

You can configure Amazon SES to notify an Amazon SNS topic when you receive bounces or complaints, or when emails are delivered. Amazon SNS notifications are in [JavaScript Object Notation (JSON)](http://www.json.org) format, which enables you to process them programmatically.

In order to send email using Amazon SES, you must configure it to send bounce and complaint notifications by using one of the following methods:
+ By sending notifications to an Amazon SNS topic. The procedure for setting up this type of notification is included in this section.
+ By enabling email feedback forwarding. For more information, see [Receiving Amazon SES notifications through email](monitor-sending-activity-using-notifications-email.md).
+ By publishing event notifications. For more information, see [Monitor email sending using Amazon SES event publishing](monitor-using-event-publishing.md).

**Important**  
See [Setting up event notifications for Amazon SES](monitor-sending-activity-using-notifications.md) for important information about notifications.

**Topics**
+ [

# Configuring Amazon SNS notifications for Amazon SES
](configure-sns-notifications.md)
+ [

# Amazon SNS notification contents for Amazon SES
](notification-contents.md)
+ [

# Amazon SNS notification examples for Amazon SES
](notification-examples.md)

# Configuring Amazon SNS notifications for Amazon SES
Configuring Amazon SNS notifications

Amazon SES can notify you of your bounces, complaints, and deliveries through [Amazon Simple Notification Service (Amazon SNS)](https://aws.amazon.com/sns).

You can configure notifications in the Amazon SES console, or by using the Amazon SES API.

**Topics**
+ [

## Prerequisites
](#configure-feedback-notifications-prerequisites)
+ [

## Configuring notifications using the Amazon SES console
](#configure-feedback-notifications-console)
+ [

## Configuring notifications using the Amazon SES API
](#configure-feedback-notifications-api)
+ [

## Troubleshooting feedback notifications
](#configure-feedback-notifications-troubleshooting)

## Prerequisites


Complete the following steps before you set up Amazon SNS notifications in Amazon SES:

1. Create a topic in Amazon SNS. For more information, see [Create a Topic](https://docs.aws.amazon.com/sns/latest/dg/CreateTopic.html) in the *Amazon Simple Notification Service Developer Guide*.
**Important**  
When you create your topic using Amazon SNS, for **Type**, only choose **Standard**. (SES does not support FIFO type topics.)

   Whether you create a new SNS topic or select an existing one, you need to give access to SES to publish notifications to the topic.

   To give Amazon SES permission to publish notifications to the topic, on the **Edit topic** screen in the SNS console, expand **Access policy** and in the **JSON editor**, add the following permission policy:

------
#### [ JSON ]

****  

   ```
   {
       "Version":"2012-10-17",		 	 	 
       "Id": "notification-policy",
       "Statement": [
           {
               "Effect": "Allow",
               "Principal": {
                   "Service": "ses.amazonaws.com"
               },
               "Action": "sns:Publish",
               "Resource": "arn:aws:sns:us-east-1:111122223333:topic_name",
               "Condition": {
                   "StringEquals": {
                       "AWS:SourceAccount": "111122223333",
                       "AWS:SourceArn": "arn:aws:ses:topic_region:111122223333:identity/identity_name"
                   }
               }
           }
       ]
   }
   ```

------

   Make the following changes to the preceding policy example:
   + Replace *topic\$1region* with the AWS Region where you created the SNS topic.
   + Replace *111122223333* with your AWS account ID.
   + Replace *topic\$1name* with the name of your SNS topic.
   + Replace *identity\$1name* with the verified identity (email address or domain) that you're subscribing to the SNS topic.

1. Subscribe at least one endpoint to the topic. For example, if you want to receive notifications by text message, subscribe an SMS endpoint (that is, a mobile phone number) to the topic. To receive notifications by email, subscribe an email endpoint (an email address) to the topic. 

   For more information, see [Getting Started](https://docs.aws.amazon.com/sns/latest/dg/sns-getting-started.html) in the *Amazon Simple Notification Service Developer Guide*.

1. (Optional) If your Amazon SNS topic uses AWS Key Management Service (AWS KMS) for server-side encryption, you have to add permissions to the AWS KMS key policy. You can add permissions by attaching the following policy to the AWS KMS key policy:

------
#### [ JSON ]

****  

   ```
   {
       "Version":"2012-10-17",		 	 	 
       "Statement": [
           {
               "Sid": "AllowSESToUseKMSKey",
               "Effect": "Allow",
               "Principal": {
                   "Service": "ses.amazonaws.com"
               },
               "Action": [
                   "kms:GenerateDataKey",
                   "kms:Decrypt"
               ],
               "Resource": "*"
           }
       ]
   }
   ```

------

## Configuring notifications using the Amazon SES console


**To configure notifications using the Amazon SES console**

1. Open the Amazon SES console at [https://console.aws.amazon.com/ses/](https://console.aws.amazon.com/ses/).

1. In the navigation pane, under **Configuration**, choose **Identities**.

1. In the **Identities** container, select the verified identity you want to receive feedback notifications for when a message sent from this identity results in either a bounce, complaint, or delivery.
**Important**  
Verified domain notification settings apply to all mail sent from email addresses in that domain *except* for email addresses that are also verified.

1. In the details screen of the verified identity you selected, choose the **Notifications** tab and select **Edit** in the **Feedback notifications** container.

1. Expand the SNS topic list box of each feedback type you want to receive notifications for, and select either an SNS topic you own, **No SNS topic**, or **SNS topic you don’t own**.

   1. If you chose **SNS topic you don’t own**, the **SNS topic ARN** field will be presented where you must enter the SNS topic ARN shared with you by your delegate sender. (Only your delegate sender will get these notifications because they own the SNS topic. To learn more about delegate sending, see [Overview of sending authorization](sending-authorization-overview.md).)
**Important**  
The Amazon SNS topics that you use for bounce, complaint, and delivery notifications have to be in the same AWS Region that in which you use Amazon SES.  
Additionally, you have to subscribe one or more endpoints to the topic in order to receive notifications. For example, if you want to have notifications sent to an email address, you have to subscribe an email endpoint to the topic. For more information, see [Getting Started](https://docs.aws.amazon.com/sns/latest/dg/sns-getting-started.html) in the *Amazon Simple Notification Service Developer Guide*.

1. (Optional) If you want your topic notification to include the headers from the original email, check the **Include original email headers** box directly underneath the SNS topic name of each feedback type. This option is only available if you've assigned an Amazon SNS topic to the associated notification type. For information about the contents of the original email headers, see the `mail` object in [Notification contents](notification-contents.md).

1. Choose **Save changes**. The changes you made to your notification settings might take a few minutes to take effect.

1. (Optional) If you chose Amazon SNS topic notifications for both bounces and complaints, you can disable email notifications entirely so that you don't receive double notifications through email and SNS notifications. To disable email notifications for bounces and complaints, under the **Notifications** tab on the details screen of the verified identity, in the **Email Feedback Forwarding** container, choose **Edit**, uncheck the **Enabled** box, and choose **Save changes**. .

After you configure your settings, you will start receiving bounce, complaint, and delivery notifications to your Amazon SNS topics. These notifications are in JavaScript Object Notation (JSON) format and follow the structure described in [Notification contents](notification-contents.md). 

You will be charged standard Amazon SNS rates for bounce, complaint, and delivery notifications. For more information, see the [Amazon SNS pricing page](https://aws.amazon.com/sns/pricing).

**Note**  
If an attempt to publish to your Amazon SNS topic fails because the topic has been deleted or your AWS account no longer has permissions to publish to it, Amazon SES removes the configuration for that topic if it's been configured for bounces or complaints (not deliveries - for delivery notifications, SES won't delete the SNS topic configuration setting). Additionally, Amazon SES re-enables bounce and complaint email notifications for the identity, and you receive a notification of the change by email. If multiple identities are configured to use the topic, the topic configuration for each identity is changed when each identity experiences a failure to publish to the topic.

## Configuring notifications using the Amazon SES API


You can also configure bounce, complaint, and delivery notifications by using the Amazon SES API. Use the following operations to configure notifications:
+ [SetIdentityNotificationTopic](https://docs.aws.amazon.com/ses/latest/APIReference/API_SetIdentityNotificationTopic.html)
+ [SetIdentityFeedbackForwardingEnabled](https://docs.aws.amazon.com/ses/latest/APIReference/API_SetIdentityFeedbackForwardingEnabled.html)
+ [GetIdentityNotificationAttributes](https://docs.aws.amazon.com/ses/latest/APIReference/API_GetIdentityNotificationAttributes.html)
+ [SetIdentityHeadersInNotificationsEnabled](https://docs.aws.amazon.com/ses/latest/APIReference/API_SetIdentityHeadersInNotificationsEnabled.html)

You can use these API actions to write a customized front-end application for notifications. For a complete description of the API actions related to notifications, see the [Amazon Simple Email Service API Reference](https://docs.aws.amazon.com/ses/latest/APIReference/).

## Troubleshooting feedback notifications


**Not receiving notifications**  
If you aren't receiving notifications, make sure that you subscribed an endpoint to the topic that the notifications are sent through. When you subscribe an email endpoint to a topic, you receive an email asking you to confirm your subscription. You have to confirm your subscription before you start receiving email notifications. For more information, see [Getting Started](https://docs.aws.amazon.com/sns/latest/dg/sns-getting-started.html) in the *Amazon Simple Notification Service Developer Guide*.

**`InvalidParameterValue` error when choosing a topic**  
If you receive an error stating that an `InvalidParameterValue` error occurred, check the Amazon SNS topic to see if it's encrypted using AWS KMS. If it is, you have to modify the policy for the AWS KMS key. See [Prerequisites](#configure-feedback-notifications-prerequisites) for a sample policy.

# Amazon SNS notification contents for Amazon SES
Notification contents

Bounce, complaint, and delivery notifications are published to [Amazon Simple Notification Service (Amazon SNS)](https://aws.amazon.com/sns) topics in JavaScript Object Notation (JSON) format. The top-level JSON object contains a `notificationType` string, a `mail` object, and either a `bounce` object, a `complaint` object, or a `delivery` object.

See the following sections for descriptions of the different types of objects:
+ [Top-level JSON object](#top-level-json-object)
+ [`mail` object](#mail-object)
+ [`bounce` object](#bounce-object)
+ [`complaint` object](#complaint-object)
+ [`delivery` object](#delivery-object)

The following are some important notes about the contents of Amazon SNS notifications for Amazon SES:
+ For a given notification type, you might receive one Amazon SNS notification for multiple recipients, or you might receive a single Amazon SNS notification per recipient. Your code should be able to parse the Amazon SNS notification and handle both cases; SES does not make ordering or batching guarantees for notifications sent through Amazon SNS. However, different Amazon SNS notification types (for example, bounces and complaints) are not combined into a single notification.
+ You might receive multiple types of Amazon SNS notifications for one recipient. For example, the receiving mail server might accept the email (triggering a delivery notification), but after processing the email, the receiving mail server might determine that the email actually results in a bounce (triggering a bounce notification). However, these are always separate notifications because they are different notification types.
+ SES reserves the right to add additional fields to the notifications. As such, applications that parse these notifications must be flexible enough to handle unknown fields.
+ SES overwrites the headers of the message when it sends the email. You can retrieve the headers of the original message from the `headers` and `commonHeaders` fields of the `mail` object.

## Top-Level JSON object
Top-level JSON object

The top-level JSON object in an SES notification contains the following fields.


| Field name | Description | 
| --- | --- | 
| notificationType |  A string that holds the type of notification represented by the JSON object. Possible values are `Bounce`, `Complaint`, or `Delivery`. If you [set up event publishing](monitor-sending-using-event-publishing-setup.md), this field is named `eventType`.  | 
| mail |  A JSON object that contains information about the original mail to which the notification pertains. For more information, see [Mail object](#mail-object).  | 
| bounce |  This field is present only if the `notificationType` is `Bounce` and contains a JSON object that holds information about the bounce. For more information, see [Bounce object](#bounce-object).  | 
| complaint |  This field is present only if the `notificationType` is `Complaint` and contains a JSON object that holds information about the complaint. For more information, see [Complaint object](#complaint-object).  | 
| delivery |  This field is present only if the `notificationType` is `Delivery` and contains a JSON object that holds information about the delivery. For more information, see [Delivery object](#delivery-object).  | 

## Mail object
`mail` object

Each bounce, complaint, or delivery notification contains information about the original email in the `mail` object. The JSON object that contains information about a `mail` object has the following fields.


| Field name | Description | 
| --- | --- | 
|  timestamp  |  The time at which the original message was sent (in ISO8601 format).  | 
|  messageId  |  A unique ID that SES assigned to the message. SES returned this value to you when you sent the message.  This message ID was assigned by SES. You can find the message ID of the original email in the `headers` field of the `mail` object.   | 
|  source  |  The email address from which the original message was sent (the envelope MAIL FROM address).  | 
|  sourceArn  |  The Amazon Resource Name (ARN) of the identity that was used to send the email. In the case of sending authorization, the `sourceArn` is the ARN of the identity that the identity owner authorized the delegate sender to use to send the email. For more information about sending authorization, see [Email authentication methodsUsing sending authorization](sending-authorization.md).  | 
|  sourceIp  |  The originating public IP address of the client that performed the email sending request to SES.  | 
|  sendingAccountId  |  The AWS account ID of the account that was used to send the email. In the case of sending authorization, the `sendingAccountId` is the delegate sender's account ID.  | 
|  callerIdentity  |  The IAM identity of the SES user who sent the email.  | 
|  destination  |  A list of email addresses that were recipients of the original mail.  | 
|  headersTruncated  |  This object is only present if you configured the notification settings to include the headers from the original email. Indicates whether the headers are truncated in the notification. SES truncates the headers in the notification when the headers from the original message are 10 KB or larger in size. Possible values are `true` and `false`.  | 
|  headers  |  This object is only present if you configured the notification settings to include the headers from the original email. A list of the email's original headers. Each header in the list has a `name` field and a `value` field.  Any message ID within the `headers` object is from the original message that you passed to SES. The message ID that SES subsequently assigned to the message is in the `messageId` field of the `mail` object.   | 
|  commonHeaders  |  This object is only present if you configured the notification settings to include the headers from the original email. Includes information about common email headers from the original email, including the From, To, and Subject fields. Within this object, each header is a key. The From and To fields are represented by arrays that can contain multiple values.  For events, any message ID within the `commonHeaders` field is the message ID that Amazon SES subsequently assigned to the message in the `messageId` field of the mail object. Notifications will contain the message ID of the original email.   | 

The following is an example of a `mail` object that includes the original email headers. When this notification type is not configured to include the original email headers, the `mail` object does not include the `headersTruncated`, `headers`, and `commonHeaders` fields. 

```
{
   "timestamp":"2018-10-08T14:05:45 +0000",
   "messageId":"000001378603177f-7a5433e7-8edb-42ae-af10-f0181f34d6ee-000000",
   "source":"sender@example.com",
   "sourceArn": "arn:aws:ses:us-east-1:888888888888:identity/example.com",
   "sourceIp": "127.0.3.0",
   "sendingAccountId":"123456789012",
   "destination":[
      "recipient@example.com"
   ],
   "headersTruncated":false,
   "headers":[ 
      { 
         "name":"From",
         "value":"\"Sender Name\" <sender@example.com>"
      },
      { 
         "name":"To",
         "value":"\"Recipient Name\" <recipient@example.com>"
      },
      { 
         "name":"Message-ID",
         "value":"custom-message-ID"
      },
      { 
         "name":"Subject",
         "value":"Hello"
      },
      { 
         "name":"Content-Type",
         "value":"text/plain; charset=\"UTF-8\""
      },
      { 
         "name":"Content-Transfer-Encoding",
         "value":"base64"
      },
      { 
         "name":"Date",
         "value":"Mon, 08 Oct 2018 14:05:45 +0000"
      }
   ],
   "commonHeaders":{ 
      "from":[ 
         "Sender Name <sender@example.com>"
      ],
      "date":"Mon, 08 Oct 2018 14:05:45 +0000",
      "to":[ 
         "Recipient Name <recipient@example.com>"
      ],
      "messageId":" custom-message-ID",
      "subject":"Message sent using SES"
   }
}
```

## Bounce object
`bounce` object

The JSON object that contains information about bounces contains the following fields.


| Field name | Description | 
| --- | --- | 
|  bounceType  |  The type of bounce, as determined by SES. For more information, see [Bounce types](#bounce-types).  | 
|  bounceSubType  |  The subtype of the bounce, as determined by SES. For more information, see [Bounce types](#bounce-types).  | 
|  bouncedRecipients  |  A list that contains information about the recipients of the original mail that bounced. For more information, see [Bounced recipients](#bounced-recipients).  | 
|  timestamp  |  The date and time at which the bounce was sent (in ISO8601 format). Note that this is the time at which the notification was sent by the ISP, and not the time at which it was received by SES.  | 
|  feedbackId  |  A unique ID for the bounce.  | 

If SES was able to contact the remote Message Transfer Authority (MTA), the following field is also present.


| Field name | Description | 
| --- | --- | 
|  remoteMtaIp  |  The IP address of the MTA to which SES attempted to deliver the email.  | 

If a delivery status notification (DSN) was attached to the bounce, the following field is also present.


| Field name | Description | 
| --- | --- | 
|  reportingMTA  |  The value of the `Reporting-MTA` field from the DSN. This is the value of the MTA that attempted to perform the delivery, relay, or gateway operation described in the DSN.  | 

The following is an example of a `bounce` object.

```
{
   "bounceType":"Permanent",
   "bounceSubType": "General",
   "bouncedRecipients":[
      {
         "status":"5.0.0",
         "action":"failed",
         "diagnosticCode":"smtp; 550 user unknown",
         "emailAddress":"recipient1@example.com"
      },
      {
         "status":"4.0.0",
         "action":"delayed",
         "emailAddress":"recipient2@example.com"
      }
   ],
   "reportingMTA": "example.com",
   "timestamp":"2012-05-25T14:59:38.605Z",
   "feedbackId":"000001378603176d-5a4b5ad9-6f30-4198-a8c3-b1eb0c270a1d-000000",
   "remoteMtaIp":"127.0.2.0"
}
```

### Bounced recipients


A bounce notification may pertain to a single recipient or to multiple recipients. The `bouncedRecipients` field holds a list of objects—one per recipient to whom the bounce notification pertains—and always contains the following field.


| Field name | Description | 
| --- | --- | 
|  emailAddress  |  The email address of the recipient. If a DSN is available, this is the value of the `Final-Recipient` field from the DSN.  | 

Optionally, if a DSN is attached to the bounce, the following fields may also be present.


| Field name | Description | 
| --- | --- | 
|  action  |  The value of the `Action` field from the DSN. This indicates the action performed by the Reporting-MTA as a result of its attempt to deliver the message to this recipient.  | 
|  status  |  The value of the `Status` field from the DSN. This is the per-recipient transport-independent status code that indicates the delivery status of the message.  | 
|  diagnosticCode  |  The status code issued by the reporting MTA. This is the value of the `Diagnostic-Code` field from the DSN. This field may be absent in the DSN (and therefore also absent in the JSON).  | 

The following is an example of an object that might be in the `bouncedRecipients` list.

```
{
    "emailAddress": "recipient@example.com",
    "action": "failed",
    "status": "5.0.0",
    "diagnosticCode": "X-Postfix; unknown user"
}
```

### Bounce types


The bounce object contains a bounce type of `Undetermined`, `Permanent` *(hard)*, or `Transient` *(soft)*. The `Permanent` *(hard)* and `Transient` *(soft)* bounce types can also contain one of several bounce subtypes. 

When you receive a bounce notification with a bounce type of `Transient` *(soft)*, you might be able to send email to that recipient in the future if the issue that caused the message to bounce is resolved. 

When you receive a bounce notification with a bounce type of `Permanent` *(hard)*, it's unlikely that you'll be able to send email to that recipient in the future. For this reason, you should immediately remove the recipient whose address produced the bounce from your mailing lists. 

**Note**  
When a *soft bounce* (a bounce related to a temporary issue, such as the recipient's inbox being full) occurs, SES attempts to redeliver the email for a certain period of time. At the end of that period of time, if SES still can't deliver the email, it stops trying.  
SES provides notifications for hard bounces, and for soft bounces that it stopped trying to deliver. If you want to receive a notification each time a soft bounce occurs, [enable event publishing](monitor-sending-using-event-publishing-setup.md) and configure it to send notifications when delivery delay events occur.


| bounceType | bounceSubType | Description | 
| --- | --- | --- | 
|  Undetermined  |  Undetermined  |  The recipient's email provider sent a bounce message. The bounce message didn't contain enough information for SES to determine the reason for the bounce. The bounce email, which was sent to the address in the Return-Path header of the email that resulted in the bounce, might contain additional information about the issue that caused the email to bounce.  | 
|  Permanent  |  General  |  The recipient's email provider sent a hard bounce message.   When you receive this type of bounce notification, you should immediately remove the recipient's email address from your mailing list. Sending messages to addresses that produce hard bounces can have a negative impact on your reputation as a sender. If you continue sending email to addresses that produce hard bounces, we might pause your ability to send additional email. See [Using the Amazon SES account-level suppression list](sending-email-suppression-list.md).   | 
|  Permanent  |  NoEmail  |  It was not possible to retrieve the recipient email address from the bounce message.   | 
|  Permanent  |  Suppressed  |  The recipient's email address is on the SES suppression list because it has a recent history of producing hard bounces. To override the global suppression list, see [Using the Amazon SES account-level suppression list](sending-email-suppression-list.md).   | 
|  Permanent  |  OnAccountSuppressionList  | SES has suppressed sending to this address because it is on the [account-level suppression list](sending-email-suppression-list.md). This does not count toward your bounce rate metric.  | 
|  Permanent  |  UnsubscribedRecipient  | This bounce type occurs when the recipient contact has unsubscribed from the topic and a mail is sent to them using [list management options](sending-email-list-management.md#configuring-list-management-list-contacts). SES respects the contact preference and doesn't attempt delivery. Also, this bounce doesn't impact sender reputation since the delivery was not attempted, nor is the recipient contact added to a suppression list due to the bounce.  It's recommended that you subscribe to UnsubscribedRecipient events to avoid continued sending to to unsubscribed recipients. Consider [Using list management](sending-email-list-management.md). List management should be the source of truth for your subscriber list. From the perspective of SES enforcement, if you continue to send to suppressed or unsubscribed recipients, you'll have the reputation of not adhering to best practices for email sending.   | 
|  Transient  |  General  |  The recipient's email provider sent a general bounce message. You might be able to send a message to the same recipient in the future if the issue that caused the message to bounce is resolved.  If you send an email to a recipient who has an active automatic response rule (such as an "out of the office" message), you might receive this type of notification. Even though the response has a notification type of `Bounce`, SES doesn't count automatic responses when it calculates the bounce rate for your account.   | 
|  Transient  |  MailboxFull  |  The recipient's email provider sent a bounce message because the recipient's inbox was full. You might be able to send to the same recipient in the future when the mailbox is no longer full.  | 
|  Transient  |  MessageTooLarge  |  The recipient's email provider sent a bounce message because message you sent was too large. You might be able to send a message to the same recipient if you reduce the size of the message.  | 
|  Transient  |  ContentRejected  |  The recipient's email provider sent a bounce message because the message you sent contains content that the provider doesn't allow. You might be able to send a message to the same recipient if you change the content of the message.  | 
|  Transient  |  AttachmentRejected  |  The recipient's email provider sent a bounce message because the message contained an unacceptable attachment. For example, some email providers may reject messages with attachments of a certain file type, or messages with very large attachments. You might be able to send a message to the same recipient if you remove or change the content of the attachment.  | 

## Complaint object
`complaint` object

The JSON object that contains information about complaints has the following fields.


| Field name | Description | 
| --- | --- | 
|  complainedRecipients  |  A list that contains information about recipients that may have been responsible for the complaint. For more information, see [Complained recipients](#complained-recipients).  | 
|  timestamp  |  The date and time when the ISP sent the complaint notification, in ISO 8601 format. The date and time in this field might not be the same as the date and time when SES received the notification.   | 
|  feedbackId  |  A unique ID associated with the complaint.  | 
|  complaintSubType  | The value of the `complaintSubType` field can either be null or `OnAccountSuppressionList`. If the value is `OnAccountSuppressionList`, SES accepted the message, but didn't attempt to send it because it was on the [account-level suppression list](sending-email-suppression-list.md). | 

Further, if a feedback report is attached to the complaint, the following fields may be present.


| Field name | Description | 
| --- | --- | 
|  userAgent  |  The value of the `User-Agent` field from the feedback report. This indicates the name and version of the system that generated the report.  | 
|  complaintFeedbackType  |  The value of the `Feedback-Type` field from the feedback report received from the ISP. This contains the type of feedback.  | 
|  arrivalDate  |  The value of the `Arrival-Date` or `Received-Date` field from the feedback report (in ISO8601 format). This field may be absent in the report (and therefore also absent in the JSON).  | 

The following is an example of a `complaint` object.

```
{
   "userAgent":"ExampleCorp Feedback Loop (V0.01)",
   "complainedRecipients":[
      {
         "emailAddress":"recipient1@example.com"
      }
   ],
   "complaintFeedbackType":"abuse",
   "arrivalDate":"2009-12-03T04:24:21.000-05:00",
   "timestamp":"2012-05-25T14:59:38.623Z",
   "feedbackId":"000001378603177f-18c07c78-fa81-4a58-9dd1-fedc3cb8f49a-000000"
}
```

### Complained recipients


The `complainedRecipients` field contains a list of recipients that may have submitted the complaint. You should use this information to determine which recipient submitted the complaint, and then immediately remove that recipient from your mailing lists. 

**Important**  
Most ISPs remove the email address of the recipient who submitted the complaint from their complaint notification. For this reason, this list contains information about recipients who might have sent the complaint, based on the recipients of the original message and the ISP from which we received the complaint. SES performs a lookup against the original message to determine this recipient list.

JSON objects in this list contain the following field.


| Field name | Description | 
| --- | --- | 
|  emailAddress  |  The email address of the recipient.  | 

The following is an example of a complained recipient object.

```
{ "emailAddress": "recipient1@example.com" }
```

**Note**  
Because of this behavior, you can be more certain that you know which email address complained about your message if you limit your sending to one message per recipient (rather than sending one message with 30 different email addresses in the bcc line).

#### Complaint types


You may see the following complaint types in the `complaintFeedbackType` field as assigned by the reporting ISP, according to the [Internet Assigned Numbers Authority website](http://www.iana.org/assignments/marf-parameters/marf-parameters.xml#marf-parameters-2):
+ `abuse`—Indicates unsolicited email or some other kind of email abuse.
+ `auth-failure`—Email authentication failure report.
+ `fraud`—Indicates some kind of fraud or phishing activity.
+ `not-spam`—Indicates that the entity providing the report does not consider the message to be spam. This may be used to correct a message that was incorrectly tagged or categorized as spam.
+ `other`—Indicates any other feedback that does not fit into other registered types.
+ `virus`—Reports that a virus is found in the originating message. 

## Delivery object
`delivery` object

The JSON object that contains information about deliveries always has the following fields.


| Field name | Description | 
| --- | --- | 
|  timestamp  |  The time SES delivered the email to the recipient's mail server (in ISO8601 format).  | 
|  processingTimeMillis  |  The time in milliseconds between when SES accepted the request from the sender to passing the message to the recipient's mail server.  | 
|  recipients  |  A list of the intended recipients of the email to which the delivery notification applies.  | 
|  smtpResponse  |  The SMTP response message of the remote ISP that accepted the email from SES. This message varies by email, by receiving mail server, and by receiving ISP.  | 
|  reportingMTA  |  The hostname of the SES mail server that sent the mail.  | 
|  remoteMtaIp  |  The IP address of the MTA to which SES delivered the email.  | 

The following is an example of a `delivery` object.

```
{
   "timestamp":"2014-05-28T22:41:01.184Z",
   "processingTimeMillis":546,
   "recipients":["success@simulator.amazonses.com"],
   "smtpResponse":"250 ok:  Message 64111812 accepted",
   "reportingMTA":"a8-70.smtp-out.amazonses.com",
   "remoteMtaIp":"127.0.2.0"
}
```

# Amazon SNS notification examples for Amazon SES
Notification examples

The following sections provide examples of the three types of notifications:
+ For bounce notification examples, see [Amazon SNS bounce notification examples](#notification-examples-bounce).
+ For complaint notification examples, see [Amazon SNS complaint notification examples](#notification-examples-complaint).
+ For delivery notification examples, see [Amazon SNS delivery notification example](#notification-examples-delivery).

## Amazon SNS bounce notification examples


This section contains examples of bounce notifications with and without a Delivery Status Notification (DSN) provided by the email receiver that sent the feedback.

### Bounce notification with a DSN


The following is an example of a bounce notification that contains a DSN and the original email headers. When bounce notifications are not configured to include the original email headers, the `mail` object within the notifications does not include the `headersTruncated`, `headers`, and `commonHeaders` fields.

```
   {
       "notificationType":"Bounce",
       "bounce":{
          "bounceType":"Permanent",
          "reportingMTA":"dns; email.example.com",
          "bouncedRecipients":[
             {
                "emailAddress":"jane@example.com",
                "status":"5.1.1",
                "action":"failed",
                "diagnosticCode":"smtp; 550 5.1.1 <jane@example.com>... User"
             }
          ],
          "bounceSubType":"General",
          "timestamp":"2016-01-27T14:59:38.237Z",
          "feedbackId":"00000138111222aa-33322211-cccc-cccc-cccc-ddddaaaa068a-000000",
          "remoteMtaIp":"127.0.2.0"
       },
       "mail":{
          "timestamp":"2016-01-27T14:59:38.237Z",
          "source":"john@example.com",
          "sourceArn": "arn:aws:ses:us-east-1:888888888888:identity/example.com",
          "sourceIp": "127.0.3.0",
          "sendingAccountId":"123456789012",
          "callerIdentity": "IAM_user_or_role_name",
          "messageId":"00000138111222aa-33322211-cccc-cccc-cccc-ddddaaaa0680-000000",
          "destination":[
            "jane@example.com",
            "mary@example.com",
            "richard@example.com"],
          "headersTruncated":false,
          "headers":[ 
           { 
             "name":"From",
             "value":"\"John Doe\" <john@example.com>"
           },
           { 
             "name":"To",
             "value":"\"Jane Doe\" <jane@example.com>, \"Mary Doe\" <mary@example.com>, \"Richard Doe\" <richard@example.com>"
           },
           { 
             "name":"Message-ID",
             "value":"custom-message-ID"
           },
           { 
             "name":"Subject",
             "value":"Hello"
           },
           { 
             "name":"Content-Type",
             "value":"text/plain; charset=\"UTF-8\""
           },
           { 
             "name":"Content-Transfer-Encoding",
             "value":"base64"
           },
           { 
             "name":"Date",
             "value":"Wed, 27 Jan 2016 14:05:45 +0000"
           }
          ],
          "commonHeaders":{ 
             "from":[ 
                "John Doe <john@example.com>"
             ],
             "date":"Wed, 27 Jan 2016 14:05:45 +0000",
             "to":[ 
                "Jane Doe <jane@example.com>, Mary Doe <mary@example.com>, Richard Doe <richard@example.com>"
             ],
             "messageId":"custom-message-ID",
             "subject":"Hello"
           }
        }
    }
```

### Bounce notification without a DSN


The following is an example of a bounce notification that includes the original email headers but does not include a DSN. When bounce notifications are not configured to include the original email headers, the `mail` object within the notifications does not include the `headersTruncated`, `headers`, and `commonHeaders` fields.

```
   {
      "notificationType":"Bounce",
      "bounce":{
         "bounceType":"Permanent",
         "bounceSubType": "General",
         "bouncedRecipients":[
            {
               "emailAddress":"jane@example.com"
            },
            {
               "emailAddress":"richard@example.com"
            }
         ],
         "timestamp":"2016-01-27T14:59:38.237Z",
         "feedbackId":"00000137860315fd-869464a4-8680-4114-98d3-716fe35851f9-000000",
         "remoteMtaIp":"127.0.2.0"
      },
      "mail":{
         "timestamp":"2016-01-27T14:59:38.237Z",
         "messageId":"00000137860315fd-34208509-5b74-41f3-95c5-22c1edc3c924-000000",
         "source":"john@example.com",
         "sourceArn": "arn:aws:ses:us-east-1:888888888888:identity/example.com",
         "sourceIp": "127.0.3.0",
         "sendingAccountId":"123456789012",
         "callerIdentity": "IAM_user_or_role_name",
         "destination":[
            "jane@example.com",
            "mary@example.com",
            "richard@example.com"
         ],
        "headersTruncated":false,
        "headers":[ 
         { 
            "name":"From",
            "value":"\"John Doe\" <john@example.com>"
         },
         { 
            "name":"To",
            "value":"\"Jane Doe\" <jane@example.com>, \"Mary Doe\" <mary@example.com>, \"Richard Doe\" <richard@example.com>"
         },
         { 
            "name":"Message-ID",
            "value":"custom-message-ID"
         },
         { 
            "name":"Subject",
            "value":"Hello"
         },
         { 
            "name":"Content-Type",
            "value":"text/plain; charset=\"UTF-8\""
         },
         { 
            "name":"Content-Transfer-Encoding",
            "value":"base64"
         },
         { 
            "name":"Date",
            "value":"Wed, 27 Jan 2016 14:05:45 +0000"
          }
         ],
         "commonHeaders":{ 
           "from":[ 
              "John Doe <john@example.com>"
           ],
           "date":"Wed, 27 Jan 2016 14:05:45 +0000",
           "to":[ 
              "Jane Doe <jane@example.com>, Mary Doe <mary@example.com>, Richard Doe <richard@example.com>"
           ],
           "messageId":"custom-message-ID",
           "subject":"Hello"
         }
      }
  }
```

## Amazon SNS complaint notification examples


This section contains examples of complaint notifications, with and without a feedback report, provided by the email receiver that sent the feedback.

### Complaint notification with a feedback report


The following is an example of a complaint notification that contains a feedback report and the original email headers. When complaint notifications are not configured to include the original email headers, the `mail` object within the notifications does not include the `headersTruncated`, `headers`, and `commonHeaders` fields.

```
   {
      "notificationType":"Complaint",
      "complaint":{
         "userAgent":"AnyCompany Feedback Loop (V0.01)",
         "complainedRecipients":[
            {
               "emailAddress":"richard@example.com"
            }
         ],
         "complaintFeedbackType":"abuse",
         "arrivalDate":"2016-01-27T14:59:38.237Z",
         "timestamp":"2016-01-27T14:59:38.237Z",
         "feedbackId":"000001378603177f-18c07c78-fa81-4a58-9dd1-fedc3cb8f49a-000000"
      },
      "mail":{
         "timestamp":"2016-01-27T14:59:38.237Z",
         "messageId":"000001378603177f-7a5433e7-8edb-42ae-af10-f0181f34d6ee-000000",
         "source":"john@example.com",
         "sourceArn": "arn:aws:ses:us-east-1:888888888888:identity/example.com",
         "sourceIp": "127.0.3.0",
         "sendingAccountId":"123456789012",
         "callerIdentity": "IAM_user_or_role_name",
         "destination":[
            "jane@example.com",
            "mary@example.com",
            "richard@example.com"
         ], 
          "headersTruncated":false,
          "headers":[ 
           { 
             "name":"From",
             "value":"\"John Doe\" <john@example.com>"
           },
           { 
             "name":"To",
             "value":"\"Jane Doe\" <jane@example.com>, \"Mary Doe\" <mary@example.com>, \"Richard Doe\" <richard@example.com>"
           },
           { 
             "name":"Message-ID",
             "value":"custom-message-ID"
           },
           { 
             "name":"Subject",
             "value":"Hello"
           },
           { 
             "name":"Content-Type",
             "value":"text/plain; charset=\"UTF-8\""
           },
           { 
             "name":"Content-Transfer-Encoding",
             "value":"base64"
           },
           { 
             "name":"Date",
             "value":"Wed, 27 Jan 2016 14:05:45 +0000"
           }
         ],
         "commonHeaders":{ 
           "from":[ 
              "John Doe <john@example.com>"
           ],
           "date":"Wed, 27 Jan 2016 14:05:45 +0000",
           "to":[ 
              "Jane Doe <jane@example.com>, Mary Doe <mary@example.com>, Richard Doe <richard@example.com>"
           ],
           "messageId":"custom-message-ID",
           "subject":"Hello"
         }
      }
   }
```

### Complaint notification without a feedback report


The following is an example of a complaint notification that includes the original email headers but does not include a feedback report. When complaint notifications are not configured to include the original email headers, the `mail` object within the notifications does not include the `headersTruncated`, `headers`, and `commonHeaders` fields.

```
   {
      "notificationType":"Complaint",
      "complaint":{
         "complainedRecipients":[
            {
               "emailAddress":"richard@example.com"
            }
         ],
         "timestamp":"2016-01-27T14:59:38.237Z",
         "feedbackId":"0000013786031775-fea503bc-7497-49e1-881b-a0379bb037d3-000000"
      },
      "mail":{
         "timestamp":"2016-01-27T14:59:38.237Z",
         "messageId":"0000013786031775-163e3910-53eb-4c8e-a04a-f29debf88a84-000000",
         "source":"john@example.com",
         "sourceArn": "arn:aws:ses:us-east-1:888888888888:identity/example.com",
         "sourceIp": "127.0.3.0",
         "sendingAccountId":"123456789012",
         "callerIdentity": "IAM_user_or_role_name",
         "destination":[
            "jane@example.com",
            "mary@example.com",
            "richard@example.com"
         ],
         "headersTruncated":false,
         "headers":[ 
          { 
            "name":"From",
            "value":"\"John Doe\" <john@example.com>"
          },
          { 
            "name":"To",
            "value":"\"Jane Doe\" <jane@example.com>, \"Mary Doe\" <mary@example.com>, \"Richard Doe\" <richard@example.com>"
          },
          { 
            "name":"Message-ID",
            "value":"custom-message-ID"
          },
          { 
            "name":"Subject",
            "value":"Hello"
          },
          { 
            "name":"Content-Type",
            "value":"text/plain; charset=\"UTF-8\""
          },
          { 
            "name":"Content-Transfer-Encoding",
            "value":"base64"
          },
          { 
            "name":"Date",
            "value":"Wed, 27 Jan 2016 14:05:45 +0000"
          }
          ],
          "commonHeaders":{ 
             "from":[ 
                "John Doe <john@example.com>"
             ],
             "date":"Wed, 27 Jan 2016 14:05:45 +0000",
             "to":[ 
                "Jane Doe <jane@example.com>, Mary Doe <mary@example.com>, Richard Doe <richard@example.com>"
             ],
             "messageId":"custom-message-ID",
             "subject":"Hello"
          }
       }
   }
```

## Amazon SNS delivery notification example


The following is an example of a delivery notification that includes the original email headers. When delivery notifications are not configured to include the original email headers, the `mail` object within the notifications does not include the `headersTruncated`, `headers`, and `commonHeaders` fields.

```
   {
      "notificationType":"Delivery",
      "mail":{
         "timestamp":"2016-01-27T14:59:38.237Z",
         "messageId":"0000014644fe5ef6-9a483358-9170-4cb4-a269-f5dcdf415321-000000",
         "source":"john@example.com",
         "sourceArn": "arn:aws:ses:us-east-1:888888888888:identity/example.com",
         "sourceIp": "127.0.3.0",
         "sendingAccountId":"123456789012",
         "callerIdentity": "IAM_user_or_role_name",
         "destination":[
            "jane@example.com"
         ], 
          "headersTruncated":false,
          "headers":[ 
           { 
              "name":"From",
              "value":"\"John Doe\" <john@example.com>"
           },
           { 
              "name":"To",
              "value":"\"Jane Doe\" <jane@example.com>"
           },
           { 
              "name":"Message-ID",
              "value":"custom-message-ID"
           },
           { 
              "name":"Subject",
              "value":"Hello"
           },
           { 
              "name":"Content-Type",
              "value":"text/plain; charset=\"UTF-8\""
           },
           { 
              "name":"Content-Transfer-Encoding",
              "value":"base64"
           },
           { 
              "name":"Date",
              "value":"Wed, 27 Jan 2016 14:58:45 +0000"
           }
          ],
          "commonHeaders":{ 
            "from":[ 
               "John Doe <john@example.com>"
            ],
            "date":"Wed, 27 Jan 2016 14:58:45 +0000",
            "to":[ 
               "Jane Doe <jane@example.com>"
            ],
            "messageId":"custom-message-ID",
            "subject":"Hello"
          }
       },
      "delivery":{
         "timestamp":"2016-01-27T14:59:38.237Z",
         "recipients":["jane@example.com"],
         "processingTimeMillis":546,     
         "reportingMTA":"a8-70.smtp-out.amazonses.com",
         "smtpResponse":"250 ok:  Message 64111812 accepted",
         "remoteMtaIp":"127.0.2.0"
      } 
   }
```