I have a script that sends an email. I would like to set it up so that the email is sent with a pdf attachment that is in my google drive. The name of the file is pdfholder.pdf
Here is the code that is currently working (without attachment), and sending emails
MailApp.sendEmail(userEmail, subject, message);
Here is the code that is not working (with the attachment), and not sending emails
var file = DocsList.getFileById('pdfholder');
MailApp.sendEmail(userEmail, subject, message, {attachments:file});
Any ideas on how to get this working? I am new to google apps scripting so simple/thorough explanations would be much appreciated. Thanks!