1

您好我正在尝试通过脚本从我的谷歌驱动器发送多个图像,但代码似乎不起作用。我怎样才能做到这一点?

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()]



  })

}
4

1 回答 1

3

终于拿到了 Google App Script 编辑器。这个变种确实有效,并向我发送了带有两个附件的电子邮件

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()

只需确保您的 Google 云端硬盘中存在“无标题文档”和“128x128_tl_icon.png”文件即可。它认为这是你的问题

于 2013-10-02T14:33:58.120 回答