用途:在 Gmail 中定位含附件的邮件,并将附件下载后上传到 Google Drive 的指定文件夹。
前提:需先加载 gws-gmail 与 gws-drive 两个技能。
使用方式(按步骤执行命令):
- 搜索带附件的邮件:gws gmail users messages list --params '{"userId": "me", "q": "has:attachment from:client@example.com"}' --format table
- 获取邮件详情:gws gmail users messages get --params '{"userId": "me", "id": "MESSAGE_ID"}'
- 下载附件:gws gmail users messages attachments get --params '{"userId": "me", "messageId": "MESSAGE_ID", "id": "ATTACHMENT_ID"}'
- 上传到 Drive 文件夹:gws drive +upload --file ./attachment.pdf --parent FOLDER_ID
适用场景:需要将指定来源邮件的附件归档到云端 Drive 目录时使用。
限制:须具备相应的 Gmail、Drive 访问权限;命令中的 userId、MESSAGE_ID、ATTACHMENT_ID、FOLDER_ID、文件名等需替换为实际值;其他细节暂未提供。