Prompt
Amazon SES SDK setup for Node
Latest observation
Oct 4, 2026
OpenAI APIWeb search: off
Here’s a simple setup for Amazon SES in Node.js using the AWS SDK.
1) Install the SDK
For AWS SDK v3:
npm install @aws-sdk/client-ses
2) Configure AWS credentials
Use one of these:
- AWS CLI config:
aws configure - Environment variables:
AWS_ACCESS_KEY_ID=your_key AWS_SECRET_ACCESS_KEY=your_secret AWS_REGION=us-east-1 - IAM role if running on AWS infrastructure
3) Send an email with SES
const { SESClient, SendEmailCommand } = require("@aws-sdk/client-ses");
const ses = new SESClient({
region: "us-east-1",
// credentials optional if already set in env / IAM role / shared config
});
async function sendEmail() {
const params = {
Source: "verified-sender@example.com",
Destination: {
ToAddresses: ["recipient@example.com"],
},
Message: {
Subject: {
Data: "Test email from SES",
Charset: "UTF-8",
},
Body: {
Text: {
Data: "Hello! This is a test email sent via Amazon SES.",
Charset: "UTF-8",
},
},
},
};
try {
const result = await ses.send(new SendEmailCommand(params));
console.log("Email sent:", result.MessageId);
} catch (err) {
console.error("Error sending email:", err);
}
}
sendEmail();
4) Important SES requirements
- Your sender email/domain must be verified in SES.
- If your SES account is in the sandbox, you can only send to verified recipients.
- Make sure the region matches where your SES identity is verified.
5) If you want HTML email
Replace the Body section:
Body: {
Html: {
Data: "<h1>Hello</h1><p>This is a test email.</p>",
Charset: "UTF-8",
},
Text: {
Data: "Hello! This is a test email.",
Charset: "UTF-8",
},
}
If you want, I can also give you:
- a nodemailer + SES setup
- a TypeScript version
- a working Express example
- or the AWS SDK v2 version