18
loading...
This website collects cookies to deliver better user experience
await ses
.sendEmail({
Destination: {
ToAddresses: [process.env.SES_EMAIL],
},
Source: process.env.SES_EMAIL,
Message: {
Subject: { Data: 'Candidate Submission' },
Body: {
Text: { Data: `My name is ${candidateName}. You can reach me at ${candidateEmail}` },
},
},
})
.promise()
var emailTemplate = {
Destination: {
ToAddresses: []
},
Source: `The Slate <${inviteEmail}>`,
Template: 'SLATE_INVITE',
TemplateData: `{ \"invited_by\":\"${userDetails.name}\", \"invite_url\": \"${url}\" }`, // THIS HAS TO BE A JSON ESCAPED STRING!?
ReplyToAddresses: [
`The Slate <${inviteEmail}>`
],
};
await ses.sendTemplatedEmail(emailTemplate).promise();
SLATE_INVITE
is a reference to an HTML and Text email template held in SES, and it will accept the references and data in TemplateData
to be rendered in the template. To me it's a nice / clearer way of making changes to the template./amplify/backend/email
. /amplify/backend/backend-config.json
that describes your amplify resources, e.g."storage": {
"slate": {
"service": "DynamoDB",
"providerPlugin": "awscloudformation"
}
},
/amplify/backend/storage
)/amplify/backend/storage/slate
) holding the cloudformation template"email": {
"invite": {
"service": "SES",
"providerPlugin": "awscloudformation"
}
},
/amplify/#current-cloud-backend/amplify-meta.json
refreshed to see your new service in the cli.