简体   繁体   English

node.js上的SES虽然返回“成功”响应,但没有发送电子邮件

[英]SES on node.js not sending the email although it return 'success' response

I tried sending an email using SES. 我尝试使用SES发送电子邮件。 The to address is same as the from address, and is verified in AWS SES. to地址与from地址相同,并在AWS SES中验证。

        usersList = [{
            "Destination": {
                "ToAddresses": [
                    "someuserthatisverifiedinSES@abc.xyz"
                ]
            },
            "ReplacementTemplateData": `{ "name":"User1", "message": "Hell no" }`
        }];
        defaultTemplateData = `{ "name":"Student", "message": ` + req.body.message + ` }`;

        var params = {
            Destinations: usersList,
            Source: "someuserthatisverifiedinSES@abc.xyz", /* required */
            Template: `SomeTemplate`, /* required */
            DefaultTemplateData: defaultTemplateData
        };
        // Create the promise and SES service object
        var sendPromise = ses.sendBulkTemplatedEmail(params).promise();

        // Handle promise's fulfilled/rejected states
        return sendPromise.then(
            function (data) {
                console.log('sent successfully');
                console.log(data);
                return data;
            }).catch(
            function (err) {
                console.log('error happened off');
                console.error(err, err.stack);
                return err;
            });
    }

I'm getting a successful response to this code. 我收到了对此代码的成功回复。

{ ResponseMetadata: { RequestId: '14ada23f-someID-5be700be687f' }, Status: [ { Status: 'Success', MessageId: '010001619e8a79ed-someID-000000' } ] } {ResponseMetadata:{RequestId:'14ada23f-someID-5be700be687f'},状态:[{状态:'成功',消息ID:'010001619e8a79ed-someID-000000'}]}

But the email is not being delivered. 但是电子邮件没有发送。

From what I figured out, the email returns success although it didn't send when the template you created doesn't match the dataset yours sending. 根据我的计算,电子邮件会返回成功,但是当您创建的模板与您发送的数据集不匹配时,它不会发送。 Maybe the template has a variable that isn't being addressed by the dataset you give it. 也许模板的变量没有被您提供的数据集所解决。

The return value will still be a success which it shouldn't. 返回值仍然是成功的,它不应该。 Upon fixing that bit, I started to receive emails. 固定那个位后,我开始接收电子邮件。 SES emails don't go to the junk too easily. SES电子邮件不会轻易进入垃圾邮件。

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

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