我从 AWS 收到 400 错误,并收到一条“无效电子邮件地址”消息 这是我正在使用的测试代码:
const { SESClient, SendEmailCommand } = require("@aws-sdk/client-ses");
void async function() {
const client = new SESClient({ region: 'us-east-1' });
const input = {
"Destination": {
"BccAddresses": [],
"CcAddresses": [
],
"ToAddresses": [
"[email protected]"
]
},
"Message": {
"Body": {
"Html": {
"Charset": "UTF-8",
"Data": "This message body contains HTML formatting. It can, for example, contain links like this one: <a class=\"ulink\" href=\"http://docs.aws.amazon.com/ses/latest/DeveloperGuide\" target=\"_blank\">Amazon SES Developer Guide</a>."
},
"Text": {
"Charset": "UTF-8",
"Data": "This is the message body in text format."
}
},
"Subject": {
"Charset": "UTF-8",
"Data": "Test email"
}
},
"ReplyToAddresses": [],
"ReturnPath": "",
"ReturnPathArn": "",
"Source": "[email protected]",
"SourceArn": ""
};
const command = new SendEmailCommand(input);
const response = await client.send(command);
console.log(response);
}();
我用于
source
的域名已验证,并且我可以使用 SDK V2 成功发送电子邮件 - 所以我认为这可能特定于我使用 V3 SDK 的方式。
SourceArn 和 ReturnPathArn 不能为空(删除它们或使用正确的值代替 Source 和 ReturnPath),并且返回地址也不能为空(在此处输入有效的电子邮件地址或将其删除)。