Hi im having trouble in sending email with image attachment. because the image file name is randomized and have no way to find out if the body of my message fits the image it will send from my drive. Here is a step by step of the process i have done:
- online form integration to google spreadsheet (done)
- online form to google drive (done) (images from each row of spreadsheet are saved by folder with folder name contains a unique id that is also present in the spreadsheet cell of each row)
- What i would like to do here is get the images of folder in google drive by a.(searching the folder name which contains a ceratin text) b.(getting the folder contents.)(all are images) c.(attaching the contents of the folder to the email .)
Example:
function send() {
var picture1 = DriveApp.getFilesByName('snottyboy.jpg');
var picture2 = DriveApp.getFilesByName('daryl.jpg');
var recipientsTO = "fgh@gmail.com" + "," + "sdd@gmail.com"+ "," + "spaz@gmail.com"+ "," + "def@gmail.com"+ "," + "abc@gmail.com";
MailApp.sendEmail({
to:recipientsTO,
subject: "LOOK A LIKE",
body:"Final Message",
attachments: [picture1.next(),picture2.next()]
});
}
Thank you for your help.