简体   繁体   English

如何在亚马逊 ses 上使用 sendBulkEmail 发送个性化电子邮件?

[英]How to send personalized emails using sendBulkEmail on amazon ses?

I have everything for my SES setup and all the requests are working.我有我的 SES 设置的一切,所有的请求都在工作。 What I am trying to do now is send personalized bulk emails using replacementData.我现在要做的是使用 replacementData 发送个性化的批量电子邮件。 So, if there are two recepients jane@doe.com and johnny@doe.com I want to replace their respective names in the template.所以,如果有两个收件人 jane@doe.com 和 johnny@doe.com 我想在模板中替换他们各自的名字。 So that Jane gets an email saying "Hi Jane" and johnny gets: "Hi Johnny".所以 Jane 得到一个 email 说“Hi Jane”,而 johnny 得到:“Hi Johnny”。 I understand that I can do this using the JSON data but I am implementing it on NodeJS and would like to use the AWS SDK as much as possible.我知道我可以使用 JSON 数据来做到这一点,但我正在 NodeJS 上实现它,并希望尽可能多地使用 AWS SDK。 The code that I am currently using:我目前使用的代码:

var params = {
    BulkEmailEntries: [ /* required */ {
            Destination: { /* required */
                BccAddresses: [],
                CcAddresses: [],
                ToAddresses: ['jane@gmail.com', 'john@gmail.com']
            },
            ReplacementEmailContent: {
                ReplacementTemplate: {
                    ReplacementTemplateData: `{"name":"Jane"},{"name":"John}`
                }
            },
            ReplacementTags: [{
                    Name: 'Test',
                    /* required */
                    Value: 'test' /* required */
                },
                /* more items */
            ]
        },
        /* more items */
    ],
    DefaultContent: { /* required */
        Template: {
            TemplateData: '{"name":"unknown"}',
            TemplateName: 'testTemplate2'
        }
    },
    DefaultEmailTags: [{
            Name: 'test',
            /* required */
            Value: 'Test' /* required */
        },
        /* more items */
    ],
    FromEmailAddress: 'info@xyz.com',
    ReplyToAddresses: []
};

The email is sent but in both of them it say "Hi Jane". email 已发送,但在两者中都说“嗨,简”。 Please help请帮忙

Can you please check if the emails are send as different mails, like no other recipients in the mail.您能否检查这些电子邮件是否作为不同的邮件发送,就像邮件中没有其他收件人一样。 I believe there must be two destinations because you have used two values in ReplacementTemplateData.我相信必须有两个目的地,因为您在 ReplacementTemplateData 中使用了两个值。 There is only one destination and two replacement data.只有一个目的地和两个替换数据。 So it is taking first replacement for both emails.因此,它首先替换了两封电子邮件。 I believe that's the issue.我相信这就是问题所在。 Please confirm.请确认。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM