AutomationFlowsEmail & Gmail › Delete Gmail Spam Automatically Every Week

Delete Gmail Spam Automatically Every Week

Original n8n title: Automatically Delete Spam Emails in Gmail on Schedule

ByBao Duy Nguyen @duynb on n8n.io

If you hate SPAM emails or don't want to clean them up frequently.

Cron / scheduled trigger★★☆☆☆ complexity5 nodesGmail
Email & Gmail Trigger: Cron / scheduled Nodes: 5 Complexity: ★★☆☆☆ Added:

This workflow corresponds to n8n.io template #4285 — we link there as the canonical source.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "DzNTc1Td148ti7RU",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Automatically delete SPAM emails",
  "tags": [
    {
      "id": "yjDYtffFaPyJlYcC",
      "name": "template",
      "createdAt": "2025-05-21T14:11:32.813Z",
      "updatedAt": "2025-05-21T14:11:32.813Z"
    }
  ],
  "nodes": [
    {
      "id": "a4fa3e50-5b63-4e69-97eb-534b1170ebab",
      "name": "Trigger at Sunday midnight",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -260,
        -20
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "weeks"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "286e5c34-18ab-46da-b184-cfabf796b21d",
      "name": "Delete SPAM emails",
      "type": "n8n-nodes-base.gmail",
      "position": [
        160,
        -20
      ],
      "parameters": {
        "messageId": "={{ $json.id }}",
        "operation": "delete"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "b755451e-7fc3-4c3b-b669-69d700c38fa4",
      "name": "Get all SPAM emails",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -60,
        -20
      ],
      "parameters": {
        "filters": {
          "labelIds": [
            "SPAM"
          ]
        },
        "operation": "getAll",
        "returnAll": true
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "cc3c9d36-a26e-47cb-bb74-3a1027b996cd",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -580,
        -260
      ],
      "parameters": {
        "color": 7,
        "width": 340,
        "height": 200,
        "content": "## Automatically delete your SPAM emails on frequent basis\n\nThis automation will run repeatedly at a particular time to delete all your SPAM emails\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "86749abf-16c8-4406-9394-b22a384b4e89",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -280,
        140
      ],
      "parameters": {
        "color": 7,
        "width": 150,
        "height": 200,
        "content": "## :point_up: UPDATE ME\nSelect when to trigger the workflow"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "f47d2f29-89d0-4719-a47b-55b43e84466b",
  "connections": {
    "Get all SPAM emails": {
      "main": [
        [
          {
            "node": "Delete SPAM emails",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Trigger at Sunday midnight": {
      "main": [
        [
          {
            "node": "Get all SPAM emails",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

If you hate SPAM emails or don't want to clean them up frequently.

Source: https://n8n.io/workflows/4285/ — original creator credit. Request a take-down →

More Email & Gmail workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Email & Gmail

Managing Gmail manually can be tedious and time-consuming. Spam, Promotions, Social, and Trash folders quickly fill up with unwanted emails, taking up valuable storage and creating clutter. This workf

Gmail
Email & Gmail

This workflow uses Gmail to send outreach emails to new Hubspot contacts that have yet to be contacted (usually unknown contacts), and records the outreach in Hubspot. Setup HubSpot Oauth2 creds (Be c

Gmail, HubSpot
Email & Gmail

The aim of the AI Latest 24 Update Workflow is to automate the daily collection and distribution of the most recent Artificial Intelligence and Technology news from the past 24 hours. It ensures users

Perplexity, Gmail
Email & Gmail

This automated n8n workflow uses the Gmail API to clean the spam folder by permanently deleting all emails on the first day of each month. The system ensures efficient email management and improves Gm

Gmail
Email & Gmail

Feel like your inbox is a junk drawer you’re scared to open? 📧

Gmail