InvalidParameterValue:重复的标头'Content-Transfer-Encoding'

问题描述 投票:0回答:1

[当我尝试通过电子邮件发送附件时收到此错误,任何人都可以告诉我我在做什么错,这是我尝试过的代码

var payload = `From: 'Amarjeet Singh' <${sender}>
To: ${recipient}
Subject: AWS SES Attachment
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=7f1a313ee430f85a8b054f085ae67abd6ee9c52aa8d056e7f7e19c6e2887
--NextPart
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
This is the <b>body</b> of the email.
--7f1a313ee430f85a8b054f085ae67abd6ee9c52aa8d056e7f7e19c6e2887
Content-Type: application/json; charset=UTF-8; 
Content-Disposition: attachment; filename="colors.json"
Content-Transfer-Encoding: base64
${file}
--NextPart--`;

var params = {
    RawMessage: {
      Data: payload
    },
    Source: "[email protected]"
  };
node.js character-encoding amazon-ses
1个回答
1
投票
[如果您使用AWS SES,则有效负载有两个问题,首先您的边界不同,其次请记住换行符,您的字符串模板应如下所示:
© www.soinside.com 2019 - 2024. All rights reserved.