I'm trying to attach a file with an email i'm sending through Google Sheet Script: "Exception: The parameters (number[],String,String,(class)) don't match the method signature for MailApp.sendEmail."
I've tried the function "MailApp.sendEmail" with the methods (number[],String,String) and it worked properly, however when adding the attachment part, it's failing...
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)]}**);
Try
MailApp.sendEmail({to: emailAddress, subject: mySubject, htmlBody: emailBody,
attachments: [file1.next().getAs(MimeType.PDF)],
})
may be subject can also cause an error ... change the term!