Email settings for Amazon Cognito user pools - Amazon Cognito
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Email settings for Amazon Cognito user pools

Certain events in your user pool's client app can cause Amazon Cognito to email your users. For example, if you configure your user pool to require email verification, Amazon Cognito sends an email when a user signs up for a new account in your app or resets their password. Depending on the action that initiates the email, the email contains a verification code or a temporary password.

To handle email delivery, you can use either of the following options:

You can change your delivery option after you create your user pool.

Amazon Cognito sends email messages to your users with either a code that they can enter or a URL link that they can select. The following table shows the events that can generate an email message.

Message options

Activity API operation Delivery options Format options Customizable Message template
Forgot password ForgotPassword Email, SMS code No N/A
Invitation AdminCreateUser Email, SMS code Yes Invitation message
Self-registration SignUp Email, SMS code, link Yes Verification message
Email address or phone number verification UpdateUserAttributes Email, SMS code Yes Verification message
Multi-factor authentication (MFA) AdminInitiateAuth, InitiateAuth SMS code Yes¹ MFA message

¹ For SMS messages.

Amazon SES charges for email messages. For more information, see Amazon SES pricing.

Default email functionality

Amazon Cognito can use its default email functionality to handle email deliveries for you. When you use the default option, Amazon Cognito limits the number of emails it sends each day for your user pool. For information on service limits, see Quotas in Amazon Cognito. For typical production environments, the default email limit is below the required delivery volume. To enable a higher delivery volume, you can use your Amazon SES email configuration.

When you use the default functionality, you use Amazon SES resources that are managed by Amazon to send email messages. Amazon SES adds email addresses that return a hard bounce to an account-level suppression list or a global suppression list. If an undeliverable email address becomes deliverable later, you can't control its removal from the suppression list while your user pool is configured to use the default functionality. An email address can remain on the Amazon-managed suppression list indefinitely. To manage undeliverable email addresses, use your Amazon SES email configuration with an account-level suppression list, as described in the next section.

When you use the default email configuration, you can use either of the following email addresses as the FROM address:

  • The default email address, no-reply@verificationemail.com.

  • A custom email address. Before you can use your own email address, you must verify it with Amazon SES and grant Amazon Cognito permission to use this address.

Amazon SES email configuration

Your application might require a higher delivery volume than what is available with the default option. To increase the possible delivery volume, use your Amazon SES resources with your user pool to email your users. You can also monitor your email sending activity when you send email messages with your own Amazon SES configuration.

Before you can use your Amazon SES configuration, you must verify one or more email addresses, or a domain, with Amazon SES. Use a verified email address, or an address from a verified domain, as the FROM email address that you assign to your user pool. When Amazon Cognito sends email to a user, it calls Amazon SES for you and uses your email address.

When you use your Amazon SES configuration, the following conditions apply:

  • The email delivery limits for your user pool are the same limits that apply to your Amazon SES verified email address in your Amazon Web Services account.

  • You can manage your messages to undeliverable email addresses with an account-level suppression list in Amazon SES that overrides the global suppression list. When you use an account-level suppression list, email message bounces affect the reputation of your account as a sender. For more information, see Using the Amazon SES account-level suppression list in the Amazon Simple Email Service Developer Guide.

Amazon SES email configuration Regions

When you choose the Amazon Web Services Region that contains the Amazon SES resources that you want to use for Amazon Cognito email messages, you can usually choose the same Region as the one where you created your user pool. Where you can, use verified identities in the Amazon Web Services Region where you created your user pool.

With Amazon Cognito user pools in some Regions, you can also use Amazon SES resources that are in the following alternate Regions: US East (N. Virginia), US West (Oregon), or Europe (Ireland). This feature supports continuity for user pool resources that you created to comply with Amazon Cognito requirements when the service launched. User pool resources that you created during that period could only use Amazon SES resources in a limited number of Amazon Web Services Regions.

With user pools in some other Regions where Amazon SES isn't available, you can only send messages with verified identities in an alternate Region. In these Regions, your Amazon SES sending authorization policy must trust a Region-specific Amazon Cognito service principal. For more information, see To grant permissions to use the default email functionality.

If you create an Amazon Cognito user pools resource with the Amazon Command Line Interface, API, or Amazon CloudFormation, your user pool sends email messages with the Amazon SES identity that the SourceArn parameter of the EmailConfigurationType object specifies for your user pool. The Amazon SES identity must occupy a supported Amazon Web Services Region. If your EmailSendingAccount is COGNITO_DEFAULT and you don't specify a SourceArn parameter, Amazon Cognito sends email messages from no-reply@verificationemail.com using resources in the Region where you created your user pool.

The following table shows the Amazon Web Services Regions where you can use Amazon SES identities with Amazon Cognito.

User pool Region Amazon SES supported Region

US East (N. Virginia)

US East (N. Virginia), US West (Oregon), Europe (Ireland)

US East (Ohio)

US East (Ohio), US East (N. Virginia), US West (Oregon), Europe (Ireland)

US West (N. California)

US West (N. California)

US West (Oregon)

US East (N. Virginia), US West (Oregon), Europe (Ireland)

Canada (Central)

Canada (Central), US East (N. Virginia), US West (Oregon), Europe (Ireland)

Asia Pacific (Tokyo)

Asia Pacific (Tokyo), US East (N. Virginia), US West (Oregon), Europe (Ireland)

Asia Pacific (Seoul)

Asia Pacific (Seoul), US East (N. Virginia), US West (Oregon), Europe (Ireland)

Asia Pacific (Mumbai)

Asia Pacific (Mumbai), US East (N. Virginia), US West (Oregon), Europe (Ireland)

Asia Pacific (Singapore)

Asia Pacific (Singapore), US East (N. Virginia), US West (Oregon), Europe (Ireland)

Asia Pacific (Sydney)

Asia Pacific (Sydney), US East (N. Virginia), US West (Oregon), Europe (Ireland)

Europe (Ireland)

US East (N. Virginia), US West (Oregon), Europe (Ireland)

Europe (London)

Europe (London), US East (N. Virginia), US West (Oregon), Europe (Ireland)

Europe (Paris)

Europe (Paris)

Europe (Frankfurt)

Europe (Frankfurt), US East (N. Virginia), US West (Oregon), Europe (Ireland)

Europe (Zurich)

Europe (Frankfurt)

Europe (Stockholm)

Europe (Stockholm)

Europe (Milan) Europe (Milan)

Middle East (Bahrain)

Middle East (Bahrain)

Middle East (UAE)

Europe (Frankfurt)

South America (São Paulo)

South America (São Paulo)

Asia Pacific (Osaka)

Asia Pacific (Osaka)

Asia Pacific (Jakarta)

Asia Pacific (Jakarta)

Israel (Tel Aviv)

Israel (Tel Aviv)

Africa (Cape Town)

Africa (Cape Town)

Configuring email for your user pool

Complete the following steps to configure the email settings for your user pool. Depending on the settings that you use, you might need IAM permissions in Amazon SES, Amazon Identity and Access Management (IAM), and Amazon Cognito.

Note

You can't share the resources that you create in these steps across Amazon Web Services accounts. For example, you can't configure a user pool in one account, and then use it with an Amazon SES email address in a different account. If you use Amazon Cognito in multiple accounts, repeat these steps for each account.

Step 1: Verify your email address or domain with Amazon SES

Before you configure your user pool, you must verify one or more domains or email addresses with Amazon SES if you want to do either of the following:

  • Use your own email address as the FROM address

  • Use your Amazon SES configuration to handle email delivery

By verifying your email address or domain, you confirm that you own it, which helps prevent unauthorized use.

For information on verifying an email address with Amazon SES, see Verifying an Email Address in the Amazon Simple Email Service Developer Guide. For information on verifying a domain with Amazon SES, see Verifying domains.

Step 2: Move your account out of the Amazon SES sandbox

Omit this step if you are using the default Amazon Cognito email functionality.

When you first use Amazon SES in any Amazon Web Services Region, it places your Amazon Web Services account in the Amazon SES sandbox for that Region. Amazon SES uses the sandbox to prevent fraud and abuse. If you use your Amazon SES configuration to handle email delivery, you must move your Amazon Web Services account out of the sandbox before Amazon Cognito can email your users.

In the sandbox, Amazon SES imposes restrictions on how many emails you can send and where you can send them. You can send emails only to addresses and domains that you have verified with Amazon SES, or you can send them to Amazon SES mailbox simulator addresses. While your Amazon Web Services account remains in the sandbox, don't use your Amazon SES configuration for applications that are in production. In this situation, Amazon Cognito can't send messages to your users' email addresses.

To remove your Amazon Web Services account from the sandbox, see Moving out of the Amazon SES sandbox in the Amazon Simple Email Service Developer Guide.

Step 3: Grant email permissions to Amazon Cognito

You might need to grant specific permissions to Amazon Cognito before it can email your users. The permissions that you grant, and the process that you use to grant them, depend on whether you are using the default email functionality, or your Amazon SES configuration.

Omit this step only if you're using the default Amazon Cognito email functionality.

If you configure your user pool to use the default Amazon Cognito' email functionality, you can use either of the following addresses as the FROM address from which Amazon Cognito emails your users:

  • The default address

  • A custom address, which must be a verified email address, or an email address in a verified domain, in Amazon SES

If you use a custom address, Amazon Cognito needs additional permissions to email users from that address. These permissions are granted by a sending authorization policy attached to the address or domain in Amazon SES. If you use the Amazon Cognito console to add a custom address to your user pool, the policy is automatically attached to the Amazon SES verified email address. However, if you configure your user pool outside of the console, such as using the Amazon CLI or the Amazon Cognito API, you must attach the policy using the Amazon SES console or the PutIdentityPolicy API.

Note

You can only configure a FROM address in a verified domain using the Amazon CLI or the Amazon Cognito API.

A sending authorization policy allows or denies access based on the account resources that are using Amazon Cognito to invoke Amazon SES. For more information about resource-based policies, see the IAM User Guide. You can also find example resource-based policies in the Amazon SES Developer Guide.

Example Sending authorization policy

The following example sending authorization policy grants Amazon Cognito a limited ability to use an Amazon SES verified identity. Amazon Cognito can only send email messages when it does so on behalf of both the user pool in the aws:SourceArn condition and the account in the aws:SourceAccount condition.

Regions with Amazon SES

Your sending authorization policy in the user pool Region or alternate Region must permit the Amazon Cognito service principal to send email messages. Refer to the Regions table for more information. If your User pool Region matches at least one value in Amazon SES Region, configure your sending authorization policy with the global service principal in the following example.

{ "Version": "2012-10-17", "Statement": [ { "Sid": "stmnt1234567891234", "Effect": "Allow", "Principal": { "Service": [ "email.cognito-idp.amazonaws.com" ] }, "Action": [ "SES:SendEmail", "SES:SendRawEmail" ], "Resource": "<your SES identity ARN>", "Condition": { "StringEquals": { "aws:SourceAccount": "<your account number>" }, "ArnLike": { "aws:SourceArn": "<your user pool ARN>" } } } ] }
Opt-in Regions without Amazon SES

Amazon SES isn't available in all opt-in Amazon Web Services Regions where Amazon Cognito is available. Middle East (UAE) is an example, and can only send emails with verified identities in Europe (Frankfurt) (eu-central-1). Your sending authorization policy in the alternate Region must permit the Amazon Cognito service principal in the opt-in Region to send email messages. Refer to the Regions table for more information. If your User pool Region shows a different Amazon SES Region, configure your sending authorization policy with the Regional service principal as in the following example. Replace the example Region identifier me-central-1 with the required Region ID as needed.

{ "Version": "2012-10-17", "Statement": [ { "Sid": "stmnt1234567891234", "Effect": "Allow", "Principal": { "Service": [ "cognito-idp.me-central-1.amazonaws.com" ] }, "Action": [ "SES:SendEmail", "SES:SendRawEmail" ], "Resource": "<your SES identity ARN>", "Condition": { "StringEquals": { "aws:SourceAccount": "<your account number>" }, "ArnLike": { "aws:SourceArn": "<your user pool ARN>" } } } ] }

In this example, the "Sid" value is an arbitrary string that uniquely identifies the statement.

For more information about policy syntax, see Amazon SES sending authorization policies in the Amazon Simple Email Service Developer Guide.

For more examples, see Amazon SES sending authorization policy examples in the Amazon Simple Email Service Developer Guide.

If you configure your user pool to use your Amazon SES configuration, Amazon Cognito needs additional permissions to call Amazon SES on your behalf when it emails your users. This authorization is granted with the IAM service.

When you configure your user pool with this option, Amazon Cognito creates a service-linked role, which is a type of IAM role, in your Amazon Web Services account. This role contains the permissions that allow Amazon Cognito to access Amazon SES and send email with your address.

Amazon Cognito creates your service-linked role with the Amazon credentials of the user session that sets the configuration. The IAM permissions of this session must include the iam:CreateServiceLinkedRole action. For more information about permissions in IAM, see Access management for Amazon resources in the IAM User Guide.

For more information about the service-linked role that Amazon Cognito creates, see Using service-linked roles for Amazon Cognito.

Step 4: Configure your user pool

Complete the following steps if you want to configure your user pool with any of the following:

  • A custom FROM address that appears as the email sender

  • A custom REPLY-TO address that receives the messages that your users send to your FROM address

  • Your Amazon SES configuration

Note

If your verified identity is an email address, Amazon Cognito sets that email address as the FROM and REPLY-TO email address by default. But, if your verified identity is a domain, you must provide a value for the FROM and REPLY-TO email addresses. For example, if your verified domain is example.com, you can set no-reply@example.com as both the FROM and REPLY-TO email addresses.

Omit this procedure if you want to use the default Amazon Cognito email functionality and address.

To configure your user pool to use a custom email address
  1. Go to the Amazon Cognito console. If prompted, enter your Amazon credentials.

  2. Choose User Pools.

  3. Choose an existing user pool from the list.

  4. Choose the Messaging tab, locate Email configuration, choose Edit.

  5. On the Edit email configuration page, select Send email from Amazon SES or Send email with Amazon Cognito. You can customize the SES Region, Configuration Set, and FROM sender name only when you choose Send email from Amazon SES.

  6. To use a custom FROM address, complete the following steps:

    1. Under SES Region, choose the Region that contains your verified email address.

    2. Under FROM email address, choose your email address. Use an email address that you have verified with Amazon SES.

    3. (Optional) Under Configuration set, choose a configuration set for Amazon SES to use. Making and saving this change creates a service-linked role.

    4. (Optional) Under FROM sender address, enter an email address. You can provide only an email address, or an email address and a friendly name in the format Jane Doe <janedoe@example.com>.

    5. (Optional) Under REPLY-TO email address, enter the email address where you want to receive messages that your users send to your FROM address.

  7. Choose Save changes.

Related Topics