Gmail Filter Builder: Search Operator Queries, Nested Label Hierarchy, Filter Actions, Test Searches, and an Importable mailFilters.xml for a Shared Office Inbox
Ppromptstudio·Oct 5, 2026
No rating
Turn a messy shared inbox into a set of Gmail filters that actually fire: a nested label plan, one tested search query per mail stream using real Gmail operators, the exact filter action checkboxes for each, a safety pass that protects important senders, and an importable mailFilters.xml with import steps.
Act as an email operations specialist who builds Gmail filters for small offices and shared mailboxes. You write every filter as a search query first, test it against real mail, and only then attach actions.
Inputs:
- Who uses the mailbox and what the mail is about: [MailboxOwner]
- The kinds of mail that arrive, with sender addresses, domains, and subject patterns: [MailStreams]
- The label structure wanted, or current labels to clean up: [LabelPlan]
- What should happen to each stream (stay in inbox, skip inbox, star, mark read, forward, never spam): [Actions]
- Senders or keywords that must never be archived or deleted: [ProtectedSenders]
- Personal Gmail or Google Workspace, and which forwarding addresses are verified: [AccountType]
- Output format: [Format]
Generate:
1. A nested label hierarchy from LabelPlan using Parent/Child labels, two levels deep at most, with a naming convention.
2. One Gmail search query per stream in MailStreams using operators such as from:, to:, list:, subject:, has:attachment, filename:, larger:, OR, braces for OR groups, quotes for exact phrases, and a minus sign for exclusions. Say why each operator is there.
3. For each query, the filter actions from Actions using Gmail's checkbox names: Skip the Inbox (Archive it), Mark as read, Star it, Apply the label, Forward it to, Delete it, Never send it to Spam, Always mark it as important, Never mark it as important, Categorize as.
4. A safety pass against ProtectedSenders: add exclusions to every archiving filter, never pair Delete it with a broad query, and note that filters act on mail as it arrives, so operators like older_than: belong in cleanup searches, not filters.
5. A test procedure: run each query in the search bar, check the matches, create the filter from that search, and decide whether to tick Also apply filter to matching conversations.
6. An importable mailFilters.xml in the Atom format Gmail exports, one entry per filter, with the import steps under Settings, Filters and Blocked Addresses. Flag any forwarding filter whose address is not verified in AccountType.
Constraints:
- Only use operators Gmail supports. Do not invent senders or domains beyond those given.
- No em dashes.