I am wrting in google bard the following prompt " Write a google app script to schedule emails from my gmail id to multiple email ids without using api. The email has a subject, three paragraphs and a pdf attachment. The email should be schlude for tommrrow morning at 9 am." Then it is spitting out this code
function sendScheduledEmails() { // Get the email recipients. var recipients = ["recip...@example.com", "recip...@example.com"]; // Create the email message. var emailSubject = "Scheduled email subject"; var emailBody = ` Paragraph 1 Paragraph 2 Paragraph 3 `; // Create a new draft email. var draftEmail = MailApp.createDraftEmail(); draftEmail.setSubject(emailSubject); draftEmail.setBody(emailBody); draftEmail.addTo(recipients); // Attach the PDF file. var pdfFile = Utilities.newBlob("application/pdf", Utilities.readFile("path/to/pdf/file.pdf")); draftEmail.addAttachment(pdfFile, "file.pdf"); // Schedule the email to be sent tomorrow morning at 9 AM. var tomorrowAt9AM = new Date(); tomorrowAt9AM.setDate(tomorrowAt9AM.getDate() + 1); tomorrowAt9AM.setHours(9); tomorrowAt9AM.setMinutes(0); tomorrowAt9AM.setSeconds(0); draftEmail.scheduleSend(tomorrowAt9AM); } // Set up a trigger to run the script tomorrow morning at 9 AM. ScriptApp.newTrigger("sendScheduledEmails").timeTrigger(new Date()).create();but the issue is that whenever i am running it I am getting the following error:
TypeError: ScriptApp.newTrigger(...).timeTrigger is not a function (anonymous)@ Code.gs:35 TypeError: ScriptApp.newTrigger(...).timeBased(...).everyDays(...).atHour(...).atMinute is not a function (anonymous)@ Code.gs:35 TypeError: MailApp.createDraftEmail is not a functionHow do I fix it?