为什么我不能在 Node 上通过 amazon ses 发送电子邮件?

Why can't I send emails through amazon ses on Node?

我正在使用 "aws-sdk":“^2.117.0”,我的代码如下所示:

var AWS = require('aws-sdk');
exports.sendAWSMail = function(message, destination){
  const ses = new AWS.SES();
  // http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/SES.html#sendEmail-property
  const sendEmail = ses.sendEmail;
  var data = {
    Destination: {
     ToAddresses: [
        "blahblah@gmail.com"
     ]
    },
    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"
     }
    },
    Source: "no-reply@frutacor.com.br",
   }
  sendEmail(data)
}

但是我得到这个错误:

TypeError: this.makeRequest 不是函数 在 svc.(匿名函数) (/Users/iagowp/Desktop/trampos/frutacor/node_modules/aws-sdk/lib/service.js:499:23)

我在他们的网站上没有找到任何 Node 示例,但从我在其他地方看到的(如 here)来看,它看起来是正确的。我做错了什么?

主要问题在第 5 行,添加用于记录错误和成功请求的回调函数始终是个好主意。

var AWS = require('aws-sdk');
exports.sendAWSMail = function(message, destination){
  const ses = new AWS.SES();
  var data = {
    Destination: {
     ToAddresses: [
        "blahblah@gmail.com"
     ]
    },
    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"
     }
    },
    Source: "no-reply@frutacor.com.br",
   }
   ses.sendEmail(data, function(err, data) {
     if (err) console.log(err, err.stack); // an error occurred
     else     console.log(data);           // successful response
   });
}