从谷歌驱动器发送多个附件,与谷歌脚本(Sending Multiple attachments wi

2019-10-18 17:04发布

你好我想通过一个脚本从我的谷歌驱动器发送多个图片,但该代码似乎并没有工作。 我怎样才能做到这一点?

function sendEmail() {

    var Rainfall = DriveApp.getFilesByName('beach.jpg')
    var High     = DriveApp.getFilesByName('High.png')

    MailApp.sendEmail({
    to:"example@google.com", 
    subject: "Images for Social Media", 
    body:"Hi Joe, here are the images for Social Media",


    attachments: [Rainfall.next(),High.next()]



  })

}

Answer 1:

终于得到了我的手到谷歌应用程序脚本编辑器。 这种变异defenitly工作,给我两个attacments电子邮件

function sendEmail() {

var Rainfall = DriveApp.getFilesByName('Untitled document')
var Rainfall2 = DriveApp.getFilesByName('128x128_tl_icon.png')

MailApp.sendEmail({
to:"mymail@gmail.com", 
subject: "Images for Social Media", 
body:"Hi Joe, here are the images for Social Media",


attachments: [Rainfall.next(), Rainfall2.next()]
  })

}
sendEmail()

只要确保文件的无标题文档“和”128x128_tl_icon.png在您的谷歌驱动器存在。 它认为这是你的问题



文章来源: Sending Multiple attachments with Google Script from Google Drive