I am trying to set up automatic email response with attachments for when a user completes a google form. One of the attachments is a zip file and the other .dmg file.From reading similar questions it looks as if the best way do this the best way is the blob function however when i try with the below code i get a attachment which is blank.I tried the mime type function also and i could not get that to work. The email does get sent but without anything in the attachment.By the code below you can probably gather i am very new to coding in google forms.
Thanks
function myFunction(e){
var userEmail = e.values[1];
var subject = " license key for students and staff only";
var message = "Your SPSS license key is ************** please access
the files via this link
https://drive.google.com/drive/folders/********";
//Get all the files from the folder
var attachements = DriveApp.getFolderById('******')
var blob = Utilities.newBlob('SPSS.png','SPSS_Statistics_24_mac.dmg');
var SPSSdmg = DriveApp.getFilesByName('SPSS_Statistics_24_mac.dmg');
var SPSSzip = DriveApp.getFilesByName('SPSS_Statistics_23_win64.zip');
// get folder
var folder = DriveApp.getFolderById('***');
// get files in the folder
var files = folder.getFiles(), file;
while (files.hasNext()) {
var file = files.next();
Logger.log(attachements)
}
attachments: attachements
MailApp.sendEmail(userEmail,subject,message, attachments :
[SPSSdmg.next(),SPSSzip.next()] {attachments: [blob]});