---
id: ssh2-recipe-label-and-archive-emails
name: "recipe-label-and-archive-emails"
url: https://skills.yangsir.net/skill/ssh2-recipe-label-and-archive-emails
author: googleworkspace
domain: ai-productivity-automation
tags: ["gmail-labels", "email-archiving", "inbox-management", "email-automation", "google-workspace"]
install_count: 30300
rating: 4.60 (25 reviews)
github: https://github.com/googleworkspace/cli
---

# recipe-label-and-archive-emails

> 为符合条件的Gmail邮件应用标签，并将其归档，以便于邮件的分类管理和查找。

**Stats**: 30,300 installs · 4.6/5 (25 reviews)

## Before / After 对比

### 智能整理邮件，保持收件箱整洁。

## Readme

# Label and Archive Gmail Threads

> **PREREQUISITE:** Load the following skills to execute this recipe: `gws-gmail`

Apply Gmail labels to matching messages and archive them to keep your inbox clean.

## Steps

1. Search for matching emails: `gws gmail users messages list --params '{"userId": "me", "q": "from:notifications@service.com"}' --format table`
2. Apply a label: `gws gmail users messages modify --params '{"userId": "me", "id": "MESSAGE_ID"}' --json '{"addLabelIds": ["LABEL_ID"]}'`
3. Archive (remove from inbox): `gws gmail users messages modify --params '{"userId": "me", "id": "MESSAGE_ID"}' --json '{"removeLabelIds": ["INBOX"]}'`



---
*Source: https://skills.yangsir.net/skill/ssh2-recipe-label-and-archive-emails*
*Markdown mirror: https://skills.yangsir.net/api/skill/ssh2-recipe-label-and-archive-emails/markdown*