可以帮我吗?
我正在尝试使用此lambda(nodejs 8)发送邮件,但是电子邮件从不发送。我在CloudWhatch上没有任何错误(所有日志均已显示-没有日志回调sendMail)。 -我正在使用美国东部的所有服务; -邮件已验证; -以及对SQS和SES的完全访问权限;
这是我的代码:
const AWS = require('aws-sdk');
const SES = new AWS.SES();
function sendMail() {
console.log("Begin - sendMail");
var params = {
Destination: {
ToAddresses: [
"mymail@domain.com"
]
},
Message: {
Subject: {
Data: "Teste",
Charset: 'UTF-8'
}
},
Source: "mymail@domain.com",
ReplyToAddresses: [
"Marcos" + '<' + "mymail@domain.com" + '>'
]
};
params.Message.Body = {
Html: {
Data: "<p>Text</p>text",
Charset: 'UTF-8'
}
};
console.log("Before send");
// Send the email
SES.sendEmail(params, function (err, data) {
if (err) {
console.log(err, err.stack);
} else {
console.log("E-mail sent"); // successful response
}
});
console.log("End - sendMail");
}
exports.handler = async (event) => {
//console.log('Received event:', JSON.stringify(event, null, 2));
event.Records.forEach(({ messageId, body }) => {
console.log('SQS message %s: %j', messageId, body);
});
sendMail();
console.log('End - handler');
};