Google apps script 借助谷歌脚本发送带有pdf附件的邮件

Google apps script 借助谷歌脚本发送带有pdf附件的邮件,google-apps-script,gmail,email-attachments,Google Apps Script,Gmail,Email Attachments,我想发送一封带有pdf附件的电子邮件。在另一个文件中,我已经意识到了这个任务。但在目前的情况下,它发送邮件,但没有附件。我将当前代码与工作代码进行比较,但没有发现错误 var pdf = DriveApp.getFileById(sourceSheet.getId()).getAs('application/pdf').getBytes(); var mailAttach = {filename: (subject + "_" + today + ".pdf"), content:pdf,

我想发送一封带有pdf附件的电子邮件。在另一个文件中,我已经意识到了这个任务。但在目前的情况下,它发送邮件,但没有附件。我将当前代码与工作代码进行比较,但没有发现错误

var pdf = DriveApp.getFileById(sourceSheet.getId()).getAs('application/pdf').getBytes();
  var mailAttach = {filename: (subject + "_" + today + ".pdf"), content:pdf, mimeType: 'application/pdf'};

  MailApp.sendEmail(recipient, subject, body, {
    attachements:[mailAttach],
    cc: recipientCC
  });

检查
attachments
参数-有一个打字错误,一个额外的
e
Oh-man。。。我不相信!非常感谢。嘿@OlegValter,你能把它作为答案发布吗?亚历山大,我知道,这样的打字错误会让人非常沮丧:)库珀已经发布了答案,所以你可以简单地接受它,不用担心
  var pdf = DriveApp.getFileById(sourceSheet.getId()).getAs('application/pdf').getBytes();
  var mailAttach = {filename: (subject + "_" + today + ".pdf"), content:pdf, mimeType: 'application/pdf'};

  MailApp.sendEmail(recipient, subject, body, {attachments:[mailAttach],cc: recipientCC});