小编Bra*_*ick的帖子

使用 Apps 脚本将 Gmail 附件复制到 Google Drive

我正在使用 Google Apps Script 自动将电子邮件中的附件保存到唯一的 Google Drive 文件夹,具体取决于邮件已过滤到的标签。

到目前为止,我已经设法使用我在网上找到的一些代码片段来获取消息 ID。但是,我一直在尝试访问邮件正文并将附件保存到驱动器文件夹中。

function getMessage(){
     var folder = DriveApp.getFolderById('xxxxxxxxxxxxx');
     var userId = "myemail@gmail.com";
     var query = "label:Global Alcohol";
     var res = Gmail.Users.Messages.list(userId, {q: query});
     var attachment = msgs.Attachments.get(userId, messageId, id);
     var ids = res.messages.map(function(e){return e.id});
     Logger.log(ids);// Message IDs with the specific labels.
     }
Run Code Online (Sandbox Code Playgroud)

在此先感谢您的帮助。

gmail google-apps-script gmail-api

1
推荐指数
1
解决办法
1816
查看次数

标签 统计

gmail ×1

gmail-api ×1

google-apps-script ×1