Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,33 +44,50 @@ To get started with Amazon SES in production, you must first [request production

After you have configured your account for production access and have verified your _sender_ email, you can configure your Cognito user pool to send emails using the verified sender:

```ts title="amplify/backend.ts"
import { Stack } from "aws-cdk-lib/core"
import { EmailIdentity } from "aws-cdk-lib/aws-ses"
import { defineBackend } from "@aws-amplify/backend"
import { auth } from "./auth/resource"

const backend = defineBackend({
auth,
```ts title="amplify/auth/resource.ts"
import { defineAuth } from "@aws-amplify/backend"

/**
* Define and configure your auth resource
* @see https://docs.amplify.aws/react/build-a-backend/auth
*/
export const auth = defineAuth({
loginWith: {
email: true,
},
senders: {
email: {
// configure using the email registered and verified in Amazon SES
fromEmail: "[email protected]",
},
},
})

const { cfnUserPool } = backend.auth.resources.cfnResources
const authStack = Stack.of(cfnUserPool)

const email = EmailIdentity.fromEmailIdentityName(
authStack,
"EmailIdentity",
// your email configured for use in SES
process.env.EMAIL
)

cfnUserPool.emailConfiguration = {
emailSendingAccount: "DEVELOPER",
sourceArn: email.emailIdentityArn,
}
```

Now when emails are sent on new user sign-ups, password resets, etc., the sending account will be your verified email.
Now when emails are sent on new user sign-ups, password resets, etc., the sending account will be your verified email! To customize further, you can change the display name of the sender, or optionally apply a custom address for your users to reply.

```ts title="amplify/auth/resource.ts"
import { defineAuth } from "@aws-amplify/backend"

/**
* Define and configure your auth resource
* @see https://docs.amplify.aws/react/build-a-backend/auth
*/
export const auth = defineAuth({
loginWith: {
email: true,
},
senders: {
email: {
fromEmail: "[email protected]",
// highlight-start
fromName: "MyApp",
replyTo: "[email protected]"
// highlight-end
},
},
})
```

## SMS

Expand Down