最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Sending Multiple attachments with Google Script from Google Drive - Stack Overflow

programmeradmin3浏览0评论

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
Add a ment  | 

1 Answer 1

Reset to default 4

Finally 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

发布评论

评论列表(0)

  1. 暂无评论