0

im trying to add an attachment to the emails im sending with courier on my nodejs program.

const file = fs.readFileSync(__dirname+'./../public/temp/file.pdf');
const strFile = new Buffer(file).toString("base64");

const {messageId} = await courier.send({
  "event": "<COURIER_NOTIFICATION_ID>",
  "recipient": "recipient_name",
  "profile": {
    "email": "example@example.com"
  },
  "override": {
    "gmail": {
      "attachments": [
        {
          "filename": "file_name.pdf",
          "contentType": "application/pdf",
          "data": strFile  //base64 string here
        }
      ]
    }
  }
});

This code is working fine for sending an email, but no attachments will be there.

4

0 回答 0