Quick overview
This workflow deterministically classifies inbound emails using local JavaScript rules (no AI) and routes them into high-priority, low-priority bulk, or general inbox actions, producing prepared outputs you can connect to Gmail or IMAP labeling, starring, and archiving steps.
How it works
- Runs manually to generate a set of sample inbound email messages for testing.
- Scores each email against a taxonomy of rule categories using headers, sender patterns, subject/body regex, and attachment heuristics.
- Selects the best-matching category, assigns a label, and produces suggested actions like star, archive, and mark-as-read based on the match.
- Routes each classified email into high-priority, low-priority bulk, or general inbox based on the suggested routing branch.
- Outputs a ready-to-execute action payload for high-priority messages to star and apply the selected labels.
- Outputs a ready-to-execute action payload for bulk messages to apply labels and archive/mark-as-read as configured, while leaving unclassified messages untouched.
Setup
- Replace the sample email generator with a live email source such as Gmail Trigger or IMAP Email Trigger.
- Customize the category taxonomy (sender patterns, header checks, regex rules, attachment rules, and actions) in the JavaScript rule engine, or supply a per-item
custom_taxonomy.
- Add and configure your mailbox action nodes (for example Gmail: Add Labels, Star Message, Move to Archive, Mark as Read) after the corresponding high-priority and bulk outputs, and map
email_id/labels to your provider’s fields.
Requirements
- n8n version 1.0.0 or higher
- Gmail OAuth2 credentials with gmail.modify scope
- No external AI model subscription or API key required
Customization
- Edit rules and category keywords in Configure Label Rules node
- Toggle dry-run mode, auto-create labels, and archive/read in Configure Gmail Triage
- Adjust score thresholds and priority weights per category
- Customize safety label names for OTP and critical alert protection
Additional info
This workflow is a deterministic, zero-AI alternative to LLM-dependent email labelers. It leverages RFC header standards (List-Unsubscribe, Auto-Submitted), literal keyword matching, sender domains, and attachment extensions with zero recurring token fees and zero private data leakage. Includes built-in safety overrides ensuring OTPs and critical alerts are never archived or marked as read.