【发布时间】:2020-04-07 21:19:18
【问题描述】:
我的问题是我无法从新的 aws ses 环境发送电子邮件,which were introduced a month ago.
所有旧的都可以正常工作(例如 us-east-1、us-west-2、eu-west-1)。 但是,如果我想从其中一个新环境发送邮件,例如eu-central-1,我刚刚收到错误消息:
The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.
但事实并非如此,因为所有旧的都可以使用相同的键正常工作。
因此,如果 sb else 可以使用他们的帐户测试示例代码以检查他们是否有同样的问题,我将不胜感激。 新环境是 eu-central-1、ap-south-1 和 ap-southeast-2。 Endpoint Urls
示例代码:
var ses = require('node-ses');
var client = ses.createClient({ key: '', secret: '', amazon: 'https://email.eu-central-1.amazonaws.com'});
async function sendMessage() {
let options = {};
options.from = "test@aol.com";
options.to = "test2@aol.com";
options.subject = "TestMail";
options.message = "Test";
console.log("Try to sendMessage");
client.sendEmail(options, function (err, data, res) {
console.log("Error: " + JSON.stringify(err));
console.log("Data: " + data);
console.log("res: " + res);
});
}
sendMessage();
示例代码使用node-ses npm package,您只需输入具有ses 访问权限的aws iam 用户凭据。
如果要检查不同的区域,则必须在createClient 构造函数中更改url。
别担心,示例代码不会发邮件!!!
如果该区域正在工作,它应该会抛出类似于此的错误消息:Email address is not verified. The following identities failed the check in region EU-WEST-1: test@aol.com, test2@aol.com"
否则错误将是上述错误。 还必须提一下,我目前仍处于沙盒模式,所以新区域可能已对沙盒用户屏蔽?
【问题讨论】:
标签: amazon-web-services amazon-ses