I tried sending an email using SES. The to address is same as the from address, and is verified in AWS SES.
usersList = [{
"Destination": {
"ToAddresses": [
"[email protected]"
]
},
"ReplacementTemplateData": `{ "name":"User1", "message": "Hell no" }`
}];
defaultTemplateData = `{ "name":"Student", "message": ` + req.body.message + ` }`;
var params = {
Destinations: usersList,
Source: "[email protected]", /* required */
Template: `SomeTemplate`, /* required */
DefaultTemplateData: defaultTemplateData
};
// Create the promise and SES service object
var sendPromise = ses.sendBulkTemplatedEmail(params).promise();
// Handle promise's fulfilled/rejected states
return sendPromise.then(
function (data) {
console.log('sent successfully');
console.log(data);
return data;
}).catch(
function (err) {
console.log('error happened off');
console.error(err, err.stack);
return err;
});
}
I'm getting a successful response to this code.
{ ResponseMetadata: { RequestId: '14ada23f-someID-5be700be687f' }, Status: [ { Status: 'Success', MessageId: '010001619e8a79ed-someID-000000' } ] }
But the email is not being delivered.
From what I figured out, the email returns success although it didn't send when the template you created doesn't match the dataset yours sending. Maybe the template has a variable that isn't being addressed by the dataset you give it.
The return value will still be a success which it shouldn't. Upon fixing that bit, I started to receive emails. SES emails don't go to the junk too easily.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With