# Simple Email Service (SES)

Source: /aws/services/ses/

## Introduction

Simple Email Service (SES) is an emailing service that can be integrated with other cloud-based services.
It provides API to facilitate email templating, sending bulk emails and more.

The supported APIs are available on the API coverage page for [SESv1](#api-coverage-sesv1) and [SESv2](#api-coverage-sesv2).

:::note
For advanced features like SMTP integration and other emulation capabilities, please refer to the Ultimate plan.
:::

## Getting Started

This is an introductory guide to get started with SES.
Basic knowledge of the AWS CLI and LocalStack [`lstk aws`](/aws/developer-tools/running-localstack/lstk/cloud-and-iac-commands/#aws) command is assumed.

Start LocalStack using your preferred method.

To be able to send emails, we need to create a verified identity.
A verified identity appears as part of the 'From' field in the sent email.

A singular email identity can be added using the `VerifyEmailIdentity` operation.

```bash
lstk aws ses verify-email-identity --email hello@example.com

lstk aws ses list-identities
```

```bash title="Output"
{
    "Identities": [
        "hello@example.com"
    ]
}
```

:::note
On AWS, verifying email identities or domain identities require additional steps like changing DNS configuration or clicking verification links respectively.
In LocalStack, identities are automatically verified.
:::

Next, emails can be sent using the `SendEmail` operation.

```bash
lstk aws ses send-email \
        --from "hello@example.com"   \
        --message 'Body={Text={Data="This is the email body"}},Subject={Data="This is the email subject"}'   \
        --destination 'ToAddresses=jeff@aws.com'
```

```bash title="Output"
{
    "MessageId": "labpqxukegeaftfh-ymaouvvy-ribr-qeoy-izfp-kxaxbfcfsgbh-wpewvd"
}
```

:::note
In LocalStack for AWS, it is possible to send real emails via an SMTP server.
:::

## Retrieve Sent Emails

LocalStack keeps track of all sent emails for retrospection.
Sent messages can be retrieved in following ways:
- **API endpoint:** LocalStack provides a service endpoint (`/_aws/ses`) which can be used to return in-memory saved messages.
    A `GET` call returns all messages.
    Query parameters `id` and `email` can be used to filter by message ID and message source respectively.

    ```bash
    curl --silent localhost.localstack.cloud:4566/_aws/ses?email=hello@example.com | jq .
    ```

    

    ```bash title="Output"
    {
      "messages": [
        {
          "Id": "dqxhhgoutkmylpbc-ffuqlkjs-ljld-fckp-hcph-wcsrkmxhhldk-pvadjc",
          "Region": "eu-central-1",
          "Destination": {
            "ToAddresses": [
              "jeff@aws.com"
            ]
          },
          "Source": "hello@example.com",
          "Subject": "This is the email subject",
          "Body": {
            "text_part": "This is the email body",
            "html_part": null
          },
          "Timestamp": "2023-09-11T08:37:13"
        }
      ]
    }
    ```
    A `DELETE` call clears all messages from the memory.
    The query parameter `id` can be used to delete only a specific message.

    ```bash
    curl -X DELETE localhost.localstack.cloud:4566/_aws/ses?id=dqxhhgoutkmylpbc-ffuqlkjs-ljld-fckp-hcph-wcsrkmxhhldk-pvadjc
    ```
- **Filesystem:** All messages are saved to the state directory (see [filesystem layout](/aws/customization/advanced/filesystem)).
    The files are saved as JSON in the `ses/` subdirectory and named by the message ID.

## SMTP Integration

LocalStack for AWS supports sending emails via an SMTP server.
To enable this, set the connections parameters and access credentials for the server in the configuration.
Refer to the [Configuration](/aws/customization/configuration-options/#emails) guide for details.

:::tip
If you do not have access to a live SMTP server, you can use tools like [MailDev](https://github.com/maildev/maildev) or [smtp4dev](https://github.com/rnwood/smtp4dev).
These run as Docker containers on your local machine.
Make sure they run in the same Docker network as the LocalStack container.
:::

## Resource Browser

LocalStack Web Application provides a resource browser for managing email identities and introspecing sent emails.

![SES Resource Browser](/images/aws/ses-resource-browser.png)

The Resource Browser allows you to perform following actions:
- **Create Email Identity**: Create an email identity by clicking **Create Identity** and specifying the email address.
- **View Sent Emails**: View all sent emails from an email identity by clicking the email address.
  You can the view the details of a sent email by selecting them from the list.
- **Send Emails**: On selecting an email identity, click **Send Message** and specify destination fields (To, CC and BCC addresses) and the body (Plaintext, HTML) to send an email.

## Current Limitations

- It is currently not possible to [receive emails via SES](https://docs.aws.amazon.com/ses/latest/dg/receiving-email.html) in LocalStack.
- All operations related to Receipt Rules are mocked.

## API Coverage (SESv1)


### Simple Email Service API coverage

Source service: `ses`. 46 of 71 tracked operations are implemented.

Service documentation: /aws/services/ses/
License availability: service entries on this page start with the Hobby or Base plans; availability can differ by service variant. See /aws/licensing/ for current plan details.

| Operation | Status |
| --- | --- |
| CloneReceiptRuleSet | Implemented |
| CreateConfigurationSet | Implemented |
| CreateConfigurationSetEventDestination | Implemented |
| CreateConfigurationSetTrackingOptions | Not implemented |
| CreateCustomVerificationEmailTemplate | Not implemented |
| CreateReceiptFilter | Not implemented |
| CreateReceiptRule | Implemented |
| CreateReceiptRuleSet | Implemented |
| CreateTemplate | Implemented |
| DeleteConfigurationSet | Implemented |
| DeleteConfigurationSetEventDestination | Implemented |
| DeleteConfigurationSetTrackingOptions | Not implemented |
| DeleteCustomVerificationEmailTemplate | Not implemented |
| DeleteIdentity | Implemented |
| DeleteIdentityPolicy | Not implemented |
| DeleteReceiptFilter | Not implemented |
| DeleteReceiptRule | Implemented |
| DeleteReceiptRuleSet | Implemented |
| DeleteTemplate | Implemented |
| DeleteVerifiedEmailAddress | Not implemented |
| DescribeActiveReceiptRuleSet | Implemented |
| DescribeConfigurationSet | Implemented |
| DescribeReceiptRule | Implemented |
| DescribeReceiptRuleSet | Implemented |
| GetAccountSendingEnabled | Not implemented |
| GetCustomVerificationEmailTemplate | Not implemented |
| GetIdentityDkimAttributes | Implemented |
| GetIdentityMailFromDomainAttributes | Implemented |
| GetIdentityNotificationAttributes | Implemented |
| GetIdentityPolicies | Not implemented |
| GetIdentityVerificationAttributes | Implemented |
| GetSendQuota | Implemented |
| GetSendStatistics | Implemented |
| GetTemplate | Implemented |
| ListConfigurationSets | Implemented |
| ListCustomVerificationEmailTemplates | Not implemented |
| ListIdentities | Implemented |
| ListIdentityPolicies | Not implemented |
| ListReceiptFilters | Not implemented |
| ListReceiptRuleSets | Implemented |
| ListTemplates | Implemented |
| ListVerifiedEmailAddresses | Implemented |
| PutConfigurationSetDeliveryOptions | Not implemented |
| PutIdentityPolicy | Not implemented |
| ReorderReceiptRuleSet | Not implemented |
| SendBounce | Not implemented |
| SendBulkTemplatedEmail | Implemented |
| SendCustomVerificationEmail | Not implemented |
| SendEmail | Implemented |
| SendRawEmail | Implemented |
| SendTemplatedEmail | Implemented |
| SetActiveReceiptRuleSet | Implemented |
| SetIdentityDkimEnabled | Not implemented |
| SetIdentityFeedbackForwardingEnabled | Implemented |
| SetIdentityHeadersInNotificationsEnabled | Implemented |
| SetIdentityMailFromDomain | Implemented |
| SetIdentityNotificationTopic | Implemented |
| SetReceiptRulePosition | Implemented |
| TestRenderTemplate | Implemented |
| UpdateAccountSendingEnabled | Not implemented |
| UpdateConfigurationSetEventDestination | Not implemented |
| UpdateConfigurationSetReputationMetricsEnabled | Implemented |
| UpdateConfigurationSetSendingEnabled | Not implemented |
| UpdateConfigurationSetTrackingOptions | Not implemented |
| UpdateCustomVerificationEmailTemplate | Not implemented |
| UpdateReceiptRule | Implemented |
| UpdateTemplate | Implemented |
| VerifyDomainDkim | Implemented |
| VerifyDomainIdentity | Implemented |
| VerifyEmailAddress | Implemented |
| VerifyEmailIdentity | Implemented |

## API Coverage (SESv2)


### Simple Email Service v2 API coverage

Source service: `sesv2`. 14 of 116 tracked operations are implemented.

Service documentation: /aws/services/ses/
License availability: service entries on this page start with the Hobby or Base plans; availability can differ by service variant. See /aws/licensing/ for current plan details.

| Operation | Status |
| --- | --- |
| AssociateEmailIdentityCertificate | Not implemented |
| BatchGetMetricData | Not implemented |
| CancelExportJob | Not implemented |
| CreateConfigurationSet | Not implemented |
| CreateConfigurationSetEventDestination | Not implemented |
| CreateContact | Not implemented |
| CreateContactList | Not implemented |
| CreateCustomVerificationEmailTemplate | Not implemented |
| CreateDedicatedIpPool | Not implemented |
| CreateDeliverabilityTestReport | Not implemented |
| CreateEmailIdentity | Implemented |
| CreateEmailIdentityPolicy | Not implemented |
| CreateEmailTemplate | Implemented |
| CreateExportJob | Not implemented |
| CreateImportJob | Not implemented |
| CreateMultiRegionEndpoint | Not implemented |
| CreateTenant | Not implemented |
| CreateTenantResourceAssociation | Not implemented |
| DeleteConfigurationSet | Not implemented |
| DeleteConfigurationSetEventDestination | Not implemented |
| DeleteContact | Not implemented |
| DeleteContactList | Not implemented |
| DeleteCustomVerificationEmailTemplate | Not implemented |
| DeleteDedicatedIpPool | Not implemented |
| DeleteEmailIdentity | Implemented |
| DeleteEmailIdentityPolicy | Not implemented |
| DeleteEmailTemplate | Implemented |
| DeleteMultiRegionEndpoint | Not implemented |
| DeleteSuppressedDestination | Not implemented |
| DeleteTenant | Not implemented |
| DeleteTenantResourceAssociation | Not implemented |
| DisassociateEmailIdentityCertificate | Not implemented |
| GetAccount | Not implemented |
| GetBlacklistReports | Not implemented |
| GetConfigurationSet | Not implemented |
| GetConfigurationSetEventDestinations | Not implemented |
| GetContact | Not implemented |
| GetContactList | Not implemented |
| GetCustomVerificationEmailTemplate | Not implemented |
| GetDedicatedIp | Not implemented |
| GetDedicatedIpPool | Not implemented |
| GetDedicatedIps | Not implemented |
| GetDeliverabilityDashboardOptions | Not implemented |
| GetDeliverabilityTestReport | Not implemented |
| GetDomainDeliverabilityCampaign | Not implemented |
| GetDomainStatisticsReport | Not implemented |
| GetEmailAddressInsights | Not implemented |
| GetEmailIdentity | Implemented |
| GetEmailIdentityPolicies | Not implemented |
| GetEmailTemplate | Not implemented |
| GetExportJob | Not implemented |
| GetImportJob | Not implemented |
| GetMessageInsights | Not implemented |
| GetMultiRegionEndpoint | Not implemented |
| GetReputationEntity | Not implemented |
| GetSuppressedDestination | Not implemented |
| GetTenant | Not implemented |
| ListConfigurationSets | Not implemented |
| ListContactLists | Not implemented |
| ListContacts | Not implemented |
| ListCustomVerificationEmailTemplates | Not implemented |
| ListDedicatedIpPools | Not implemented |
| ListDeliverabilityTestReports | Not implemented |
| ListDomainDeliverabilityCampaigns | Not implemented |
| ListEmailIdentities | Implemented |
| ListEmailIdentityCertificates | Not implemented |
| ListEmailTemplates | Implemented |
| ListExportJobs | Not implemented |
| ListImportJobs | Not implemented |
| ListMultiRegionEndpoints | Not implemented |
| ListRecommendations | Not implemented |
| ListReputationEntities | Not implemented |
| ListResourceTenants | Not implemented |
| ListSuppressedDestinations | Not implemented |
| ListTagsForResource | Not implemented |
| ListTenantResources | Not implemented |
| ListTenants | Not implemented |
| PutAccountDedicatedIpWarmupAttributes | Not implemented |
| PutAccountDetails | Not implemented |
| PutAccountPricingAttributes | Not implemented |
| PutAccountSendingAttributes | Not implemented |
| PutAccountSuppressionAttributes | Not implemented |
| PutAccountVdmAttributes | Not implemented |
| PutConfigurationSetArchivingOptions | Not implemented |
| PutConfigurationSetDeliveryOptions | Not implemented |
| PutConfigurationSetReputationOptions | Not implemented |
| PutConfigurationSetSendingOptions | Not implemented |
| PutConfigurationSetSuppressionOptions | Not implemented |
| PutConfigurationSetTrackingOptions | Not implemented |
| PutConfigurationSetVdmOptions | Not implemented |
| PutDedicatedIpInPool | Not implemented |
| PutDedicatedIpPoolScalingAttributes | Not implemented |
| PutDedicatedIpWarmupAttributes | Not implemented |
| PutDeliverabilityDashboardOption | Not implemented |
| PutEmailIdentityConfigurationSetAttributes | Implemented |
| PutEmailIdentityDkimAttributes | Implemented |
| PutEmailIdentityDkimSigningAttributes | Implemented |
| PutEmailIdentityFeedbackAttributes | Implemented |
| PutEmailIdentityMailFromAttributes | Implemented |
| PutSuppressedDestination | Not implemented |
| PutTenantSuppressionAttributes | Not implemented |
| SendBulkEmail | Implemented |
| SendCustomVerificationEmail | Not implemented |
| SendEmail | Implemented |
| TagResource | Not implemented |
| TestRenderEmailTemplate | Not implemented |
| UntagResource | Not implemented |
| UpdateConfigurationSet | Not implemented |
| UpdateConfigurationSetEventDestination | Not implemented |
| UpdateContact | Not implemented |
| UpdateContactList | Not implemented |
| UpdateCustomVerificationEmailTemplate | Not implemented |
| UpdateEmailIdentityPolicy | Not implemented |
| UpdateEmailTemplate | Not implemented |
| UpdateReputationEntityCustomerManagedStatus | Not implemented |
| UpdateReputationEntityPolicy | Not implemented |
