// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 // ABOUT THIS NODE.JS SAMPLE: This sample is part of the SDK for JavaScript Developer Guide topic at // https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide//ses-examples-sending-email.html // snippet-start:[ses.JavaScript.email.sendTemplatedEmail] // Load the AWS SDK for Node.js var AWS = require("aws-sdk"); // Set the region AWS.config.update({ region: "REGION" }); // Create sendTemplatedEmail params var params = { Destination: { /* required */ CcAddresses: [ "EMAIL_ADDRESS", /* more CC email addresses */ ], ToAddresses: [ "EMAIL_ADDRESS", /* more To email addresses */ ], }, Source: "EMAIL_ADDRESS" /* required */, Template: "TEMPLATE_NAME" /* required */, TemplateData: '{ "REPLACEMENT_TAG_NAME":"REPLACEMENT_VALUE" }' /* required */, ReplyToAddresses: ["EMAIL_ADDRESS"], }; // Create the promise and SES service object var sendPromise = new AWS.SES({ apiVersion: "2010-12-01" }) .sendTemplatedEmail(params) .promise(); // Handle promise's fulfilled/rejected states sendPromise .then(function (data) { console.log(data); }) .catch(function (err) { console.error(err, err.stack); }); // snippet-end:[ses.JavaScript.email.sendTemplatedEmail]