0
我有一個腳本,它生成一個文檔,保存爲PDF並附加到電子郵件。除了這個附件之外,我正在嘗試添加第二個附件,它是保存在Google Drive(條款)上的現有PDF。爲什麼下面的代碼不附加第二個文檔?將多個附件添加到電子郵件
if (email_status == "YES") {
//send a pdf copy to customer
var pdfEMAIL = DriveApp.getFileById(doc.getId()).getAs('application/pdf').getBytes();
var terms = DriveApp.getFileById('file ID');
var message = "Hi " + usernamefordoctitle + "!, please kindly find your invoice attached.\nMany Thanks!\nMe";
var emailAdd = sheet.getRange("D2").getValue()
var emailTo = emailAdd; // add customer email here
var subject = "Invoice for " + usernamefordoctitle + " from ME" + " - Invoice Number : " + newInvNumber;
var attach = {fileName:"INVOICE " + newInvNumber + " " + usernamefordoctitle + '.pdf',content:pdfEMAIL, mimeType:'application/pdf'};
MailApp.sendEmail(emailTo, subject, message, {attachments:[attach, terms.next()]});
ss.toast("70%: emailed customer");
Utilities.sleep(sleepINT);
}