Report spam and phishing URLs from IMAP mailboxes to Spamhaus
Ready for 3.0What this workflow does
This workflow has 14 nodes and runs when a new email arrives over IMAP (plus 1 other trigger). It uses only n8n's built-in nodes. It also calls submit.spamhaus.org over HTTP.
How it runs
Trigger: When a new email arrives over IMAP (plus 1 other trigger).
- initial config spam (Edit Fields (Set)): sets 3 fields: email, threat_type, reason.url
- initial phish config (Edit Fields (Set)): sets 3 fields: email, threat_type, reason.url
- Loop over each email (Loop Over Items (Split in Batches)): loops over the items in batches
- extract all URLs (Code): runs custom JavaScript code
- de-duplicate URLs (Remove Duplicates): removes duplicate items
- split URLs to array (Split Out): splits a list into separate items
- Filter: keeps only the items that match a condition
- create item for spamhaus (Edit Fields (Set)): sets 3 fields: source.object, threat_type, reason
- Spamhaus submit url (HTTP Request): calls submit.spamhaus.org (POST)
- Aggregate: combines items into one
HTTP calls to: submit.spamhaus.org
Before you upgrade to n8n 3.0
Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.
Nodes used (10)
- Email Trigger (IMAP)
n8n-nodes-base.emailReadImap - Edit Fields (Set)
n8n-nodes-base.set - Code
n8n-nodes-base.code - HTTP Request
n8n-nodes-base.httpRequest - Loop Over Items (Split in Batches)
n8n-nodes-base.splitInBatches - Aggregate
n8n-nodes-base.aggregate - No Operation, do nothing
n8n-nodes-base.noOp - Remove Duplicates
n8n-nodes-base.removeDuplicates - Split Out
n8n-nodes-base.splitOut - Filter
n8n-nodes-base.filter
From the author
This workflow automates URL reporting to Spamhaus based on incoming spam/phishing sample emails. It watches one or more IMAP folders, extracts URLs from each email body, removes duplicates and common noise, and submits the remaining URLs to the Spamhaus…