我正在使用 AMAZON SES 发送电子邮件和 AMAZON SNS 订阅挂钩并接收个性化通知(基本上是在电子邮件发送、退回或拒绝时)。
这里的重点是我正在尝试过滤电子邮件类型。发送电子邮件时,我在其中添加了一个标签,例如:“recoverEmail”。有了这个,当我收到挂钩的交货通知时,我确切地知道我应该在哪里寻找交易记录以正确更新它。
我找不到任何搜索,即使在文档中也是如此。这就是我作为参数传递的内容:
const params = {
EmailTags: [{
Name: 'emailType',
Value: 'recoverPassword',
}],
Destination: {
ToAddresses: process.env.NODE_ENV === 'production' ? [email] : [EmailSender.SANDBOX_EMAIL_TO],
},
Content: {
Simple: {
Body: {
Text: {
Data: text,
},
},
Subject: {
Data: `Recover your password for ${email} account`,
},
},
},
FromEmailAddress: EmailSender.EMAIL_FROM,
};
它可以正常工作并发送电子邮件,但是当我收到送货通知时,标签不在任何地方:
{
headers: {
host: 'xxxxxxxxx.ngrok.io',
'user-agent': 'Amazon Simple Notification Service Agent',
'content-length': '1682',
'accept-encoding': 'gzip,deflate',
'content-type': 'application/json',
'x-amz-sns-message-id': 'xxxxxxx-670f-5f63-9dc9-xxxxxxxxx',
'x-amz-sns-message-type': 'Notification',
'x-amz-sns-subscription-arn': 'arn:aws:sns:us-east-1:xxxxxxxx:xxxxxxxx-email-xxxxxx:yyyyyyyy-df21-478c-aaaaa-xxxxxxxxxx',
'x-amz-sns-topic-arn': 'arn:aws:sns:us-east-1:xxxxxxxxx:xxxxxxxxxx-email-xxxxxxx',
'x-forwarded-for': 'xxx.xxx.xxx.xxx',
'x-forwarded-proto': 'https'
},
type: 'Notification',
timestamp: '2023-04-14T04:45:57.113Z',
message: {
notificationType: 'Delivery',
mail: {
timestamp: '2023-04-14T04:45:55.792Z',
source: '[email protected]',
sourceArn: 'arn:aws:ses:us-east-1:xxxxxxxxx:identity/xxxxxxxx.com',
sourceIp: 'xxx.xxx.xxx.xxx',
callerIdentity: 'xxxx-api-xxxxxx',
sendingAccountId: 'xxxxxxxxxxxxx',
messageId: 'xxxxxxxxxxxx-xxxxxxxx-7e9a-4bc3-b4f7-xxxxxxxxx-000000',
destination: [Array]
},
delivery: {
timestamp: '2023-04-14T04:45:57.046Z',
processingTimeMillis: 1254,
recipients: [Array],
smtpResponse: '250 2.0.0 OK 1681447557 i14-xxxxxxxxxxxxxxxxxx.127 - gsmtp',
remoteMtaIp: 'xxx.xxx.xxx.xxx',
reportingMTA: 'a8-97.smtp-out.amazonses.com'
}
},
如果有人知道这方面的诀窍,会对我很有帮助。
我尝试了几个网络搜索和文档审查。我还没有找到任何可以帮助的东西。