recipe-forward-labeled-emails

Forwards Gmail messages matching a specific label to another email address.

Updated Nov 9, 2023
One-click install
npx skills add https://github.com/oresttokovenko/dot-files --skill recipe-forward-labeled-emails-oresttokovenko
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: recipe-forward-labeled-emails
Source: https://github.com/oresttokovenko/dot-files/tree/main/chezmoi/dot_agents/skills/recipe-forward-labeled-emails
Command: npx skills add https://github.com/oresttokovenko/dot-files --skill recipe-forward-labeled-emails-oresttokovenko

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Manually finding and forwarding groups of labeled Gmail messages is repetitive and error-prone. This recipe automates the lookup of messages under a given label and forwards their content to a designated recipient. ## Core Features & Use Cases - Label-Based Message Search: Lists Gmail messages matching a label query such as "label:needs-review" via the Gmail API. - Message Content Retrieval: Fetches full message content by message ID for forwarding. - Automated Forwarding: Composes and sends a new email containing the original subject and body to a target address. - Use Case: A team lead labels emails "needs-review" throughout the week, then forwards all of them to a manager in one batch for review. ## Quick Start Forward all Gmail messages labeled needs-review to [email protected].

Frequently Asked Questions about recipe-forward-labeled-emails

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I forward Gmail messages with a specific label?

List messages with the Gmail API using a query like "label:needs-review", retrieve each message's content by ID, then send a new email containing the original subject and body to the target address using gws gmail +send.

How to search Gmail messages by label using the Gmail API?

Use the users messages list endpoint with a query parameter such as "label:needs-review" and userId set to "me". The gws CLI command returns matching messages in table format for further processing.

What tools are required to forward labeled Gmail messages?

This recipe requires the gws command-line tool and the gws-gmail skill, which provides access to Gmail API operations including listing, reading, and sending messages.

Does this forward emails as attachments or inline content?

It forwards content inline by composing a new email with the original subject prefixed with FW and the original message body in the new email body. It does not attach the original message as an .eml file.

Why does the Gmail label search return no messages?

The label name in the query must exactly match an existing Gmail label, including hyphens or capitalization. Verify the label exists in your Gmail account and that the authenticated user has messages under that label.