MailApp.sendEmail方法签名异常:参数(class)不匹配

MailApp.sendEmail method signature exception: The parameters (class) don't match

我正在尝试在通过 Google Sheet 发送的电子邮件中附加一个文件 脚本: “异常:参数 (number[],String,String,(class)) 与 MailApp.sendEmail 的方法签名不匹配。”

我已经用方法 (number[],String,String) 尝试了函数“MailApp.sendEmail”并且它工作正常,但是在添加附件部分时,它失败了...

    var file1 = DriveApp.getFilesByName("why abilix.PDF");
    var emailBody = textTemplate[0][0].replace("{patient.name}",patientNames[i][0])
                                .replace("{stage}",phase[j]);
    var emailAddress = patientEmails[i];
    MailApp.sendEmail(emailAddress, subject, emailBody, **{
                      name: 'Automatic Emailer Script',
                      attachments: [file1.next().getAs(MimeType.PDF)]}**);

尝试

MailApp.sendEmail({to: emailAddress, subject: mySubject, htmlBody: emailBody, 
     attachments: [file1.next().getAs(MimeType.PDF)],
     })

可能是主题也可能导致错误...更改术语!