AWS SES / SNS通知没有原始标头

时间:2017-08-21 12:40:05

标签: header aws-lambda amazon-sns amazon-ses nodemailer

我正在通过AWS Lambda运行通知节点快速后端服务,以通过ses发送电子邮件并捕获退回和投诉,以便在某些条件下将其列入黑名单。 我正在使用nodemailers Mailcomposer模块撰写原始电子邮件。

这是我发送电子邮件的代码

var AWS          = require("aws-sdk");
var mailComposer = require('nodemailer/lib/mail-composer');

var ses = new AWS.SES({
...
}

let mailOptions = {
  from : "sender name <user@domain.com>",
  to : ["bounce@simulator.amazonses.com"],
  replyTo : 'demo@demo.com',
  inReplyTo : '12345-message-id', // The message-id this message is replying
  subject : "subject of this email",
  text : Buffer.from("plaint text version of the email", 'utf-8'), 
  html : Buffer.from("<div><p>Hello Customer</p></div>", 'utf-8'),

  // AND MY CUSTOM HEADER
  headers : {"customHeader" : "13371337"}, 

};
let mail = new mailComposer(mailOptions);
mail.compile().build((err, mailData) => {

  if(err){
    console.log("error occured compiling");
    console.log(err);
    return;
  }

  var params = {
    RawMessage : {
      Data : mailData
    },
  };

  ses.sendRawEmail(params, (err, data) => {
    if(err){
      console.log("error occured sending email");
      console.log(err);
    }else{
      console.log("success");
      console.log(data);
    }
  });
});

我还在域名SES通知设置中启用了“包含原始标题”,电子邮件已成功发送,但我的通知后端服务未在任何地方收到 customHeader ...

0 个答案:

没有答案