Automate Gmail Cleanup: Delete Unsubscribe and Spam Emails
detail.loadingPreview
Streamline your inbox by automatically identifying and deleting unwanted emails like spam, unsubscribe requests, and promotional content. This workflow helps you maintain a clutter-free Gmail account with minimal effort.
About This Workflow
This n8n workflow is designed to significantly reduce inbox clutter by targeting and removing specific types of unwanted emails from your Gmail account. It leverages the Gmail node to intelligently search for messages that are likely to be spam, unsubscribe attempts, or other promotional content that you don't need. The workflow efficiently fetches email IDs, batches them for processing, and then securely deletes them in bulk. By setting up this automation, you can reclaim valuable inbox space and focus on what truly matters without the constant distraction of irrelevant messages.
Key Features
- Smart Email Filtering: Automatically identifies and targets emails based on keywords like 'unsubscribe', 'license', 'key', and 'password' to exclude important messages.
- Batch Processing: Efficiently handles large volumes of emails by processing them in batches of 100, ensuring smooth operation.
- Secure Deletion: Safely removes identified unwanted emails from your Gmail inbox.
- Manual Trigger: Allows you to initiate the cleanup process with a single click.
How To Use
- Set up Gmail Trigger: Start with the 'On clicking 'execute'' node. This will be your manual trigger to run the workflow.
- Fetch Email IDs: Connect a 'Gmail' node configured for 'getAll' messages. Set the 'q' parameter to
-in:chats unsubscribe -license -key -passwordto exclude chats and emails containing these terms. Set 'format' to 'ids' to retrieve only the IDs. - Batch Emails: Connect a 'SplitInBatches' node to the Gmail node. Set the 'batchSize' to 100 (or adjust as needed) to process emails in manageable groups.
- Delete Emails: Connect another 'Gmail' node to the 'SplitInBatches' node. Configure this node for the 'delete' operation and set the 'messageId' parameter to
={{$json["id"]}}to dynamically pull the ID from each batch. - Configure Credentials: Ensure you have set up your Gmail OAuth2 credentials for both Gmail nodes.
Apps Used
Workflow JSON
{
"id": "c5d12fc2-a7c1-4c9c-8f41-c1f9bb70c93d",
"name": "Automate Gmail Cleanup: Delete Unsubscribe and Spam Emails",
"nodes": 16,
"category": "Personal",
"status": "active",
"version": "1.0.0"
}Note: This is a sample preview. The full workflow JSON contains node configurations, credentials placeholders, and execution logic.
Get This Workflow
ID: c5d12fc2-a7c1...
About the Author
N8N_Community_Pick
Curator
Hand-picked high quality workflows from the global community.
Statistics
Related Workflows
Discover more workflows you might like
Automate Your Daily Briefing: News, Emails, and Tasks
Streamline your day by automatically fetching the latest news from Times of India, important emails from your Gmail, and your upcoming Todoist tasks. Get a consolidated, beautifully formatted daily digest delivered straight to your inbox.
Daily AI-Powered Morning Briefing
Start your day with clarity and focus using this n8n workflow. It automatically fetches your tasks from Todoist and events from Google Calendar, then leverages AI to create a concise, personalized daily briefing delivered directly to your inbox every morning. This ensures you always know your top priorities and upcoming schedule at a glance.
AI Music Generator with Suno V3.5 (KIE.ai)
This n8n workflow automates AI music generation using the KIE.ai API, powered by the Suno V3.5 model. Users simply submit music prompts, styles, and titles via a web form, and the system handles real-time generation and delivery of the final audio output. It's perfect for quickly creating custom music for various needs.