πŸ”’ Report spam and phishing URLs from IMAP mailboxes to Spamhaus

⚑ 57 views Β· πŸ”’ SecOps & Security Automation

Description

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 submission API with the appropriate threat context.

What it does

How it works (high level)

  1. IMAP triggers fetch new messages from configured folders.
  2. An initial Set node attaches metadata such as:
  1. SplitInBatches loops over each email.
  2. A Code node extracts all URLs from the email body, normalizes them, and removes obvious noise (e.g., trailing punctuation).
  3. Remove Duplicates clears dedupe history and ensures only unique URLs are processed per run.
  4. URLs are split into single items, filtered, and then packaged into the Spamhaus request body.
  5. HTTP Request submits each URL to Spamhaus.
  6. Aggregate collects results, enabling optional per-run actions at the end.

Extending with more IMAP triggers

You can add as many additional IMAP triggers as needed. To do so, connect each new IMAP trigger to the same initial Set node (or duplicate that Set node per trigger) to define the correct threat_type and reason.url. The downstream flow stays unchanged.

Customization points

Requirements

Notes

πŸ”— Nodes Used

Email Trigger (IMAP), HTTP Request, Filter

πŸ“₯ Import

Download workflow.json and import into n8n: Workflow menu β†’ Import from File

πŸ“– Importing guide Β· πŸ”‘ Credential setup