Hi I am trying to send multiple images from my google drive via a script but the code does not seem to work. How can I achieve this?
function sendEmail() {
var Rainfall = DriveApp.getFilesByName('beach.jpg')
var High = DriveApp.getFilesByName('High.png')
MailApp.sendEmail({
to:"[email protected]",
subject: "Images for Social Media",
body:"Hi Joe, here are the images for Social Media",
attachments: [Rainfall.next(),High.next()]
})
}
Hi I am trying to send multiple images from my google drive via a script but the code does not seem to work. How can I achieve this?
function sendEmail() {
var Rainfall = DriveApp.getFilesByName('beach.jpg')
var High = DriveApp.getFilesByName('High.png')
MailApp.sendEmail({
to:"[email protected]",
subject: "Images for Social Media",
body:"Hi Joe, here are the images for Social Media",
attachments: [Rainfall.next(),High.next()]
})
}
Share
Improve this question
edited Nov 21, 2013 at 16:42
Mogsdad
45.8k21 gold badges163 silver badges285 bronze badges
asked Oct 2, 2013 at 11:30
Molulaqhooa MaoyiMolulaqhooa Maoyi
811 gold badge3 silver badges7 bronze badges
1 Answer
Reset to default 4Finally got my hands to Google App Script editor. This variant defenitly worked and send me email with two attacments
function sendEmail() {
var Rainfall = DriveApp.getFilesByName('Untitled document')
var Rainfall2 = DriveApp.getFilesByName('128x128_tl_icon.png')
MailApp.sendEmail({
to:"[email protected]",
subject: "Images for Social Media",
body:"Hi Joe, here are the images for Social Media",
attachments: [Rainfall.next(), Rainfall2.next()]
})
}
sendEmail()
Just make sure that files 'Untitled document' and '128x128_tl_icon.png' exists on your Google Drive. It think this is your problem