【问题标题】:Sending mails with headers AWS Lambda SES发送带有标头的邮件 AWS Lambda SES
【发布时间】:2019-07-09 18:19:25
【问题描述】:

我正在使用 .. 从 AWS lambda 发送邮件

const params = {
    Destination: {
      ToAddresses: ["xxx@xxx.com"]
    },
    Header : {
      "Reply-To" : "hello@gmail.com"
    },
    Message: {
      Body: {
        Html: {
          Charset: "UTF-8",
          Data: htmlBody
        },
        Text: {
          Charset: "UTF-8",
          Data: textBody
        }
      },
      Subject: {
        Charset: "UTF-8",
        Data: "My title"
      }
    },
    Source: "xxx.com"
  };

  // Create the promise and SES service object
  const sendPromise = new AWS.SES({ apiVersion: "2010-12-01",region: 'us-east-1' })
    .sendEmail(params)
    .promise();

但是,它给了UnexpectedParameter: Unexpected key 'Headers' found in params

如何使用 SES 和 Lambda 正确发送标头, 我主要需要使用reply-to

【问题讨论】:

    标签: amazon-web-services aws-lambda amazon-ses


    【解决方案1】:

    SES sendEmail 函数参数没有 Header 键。我相信您正在寻找名为ReplyToAddresses 的密钥,这是一个电子邮件地址列表。

    所以你可以替换

    Header : {
        "Reply-To" : "hello@gmail.com"
    },
    

    在你的代码中

    ReplyToAddresses: [ "hello@gmail.com" ]
    
    猜你喜欢
    • 2019-12-07
    • 1970-01-01
    • 2016-11-17
    • 1970-01-01
    • 2020-11-25
    • 2017-09-28
    • 2012-06-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多