I want to send an email with a pdf attachment. In another file, I did already realize that task. But in the current case it sends the mail but without an attachment. I compare the current code to the working code but I didn't find a mistake.
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
});
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});