8
n8n 中文网amn8n.com

自动删除垃圾邮件

初级

这是一个Other领域的自动化工作流,包含 5 个节点。主要使用 Gmail, ScheduleTrigger 等节点。 按计划自动删除Gmail中的垃圾邮件

前置要求
  • Google 账号和 Gmail API 凭证

分类

工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "DzNTc1Td148ti7RU",
  "meta": {
    "instanceId": "e76981884963d13b9deb7bc5a6b15daf6838937e1dd529f22f2c146d8b79cae4",
    "templateCredsSetupCompleted": true
  },
  "name": "自动删除垃圾邮件",
  "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": "周日午夜触发",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -260,
        -20
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "weeks"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "286e5c34-18ab-46da-b184-cfabf796b21d",
      "name": "删除垃圾邮件",
      "type": "n8n-nodes-base.gmail",
      "position": [
        160,
        -20
      ],
      "webhookId": "46b0fe0f-cc00-4994-8364-9048c888e9ef",
      "parameters": {
        "messageId": "={{ $json.id }}",
        "operation": "delete"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "yz4iqcG5X1s5wlgS",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "b755451e-7fc3-4c3b-b669-69d700c38fa4",
      "name": "获取所有垃圾邮件",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -60,
        -20
      ],
      "webhookId": "c47419de-278c-40d1-a5da-c9414d3f89c6",
      "parameters": {
        "filters": {
          "labelIds": [
            "SPAM"
          ]
        },
        "operation": "getAll",
        "returnAll": true
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "yz4iqcG5X1s5wlgS",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "cc3c9d36-a26e-47cb-bb74-3a1027b996cd",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -580,
        -260
      ],
      "parameters": {
        "color": 7,
        "width": 340,
        "height": 200,
        "content": "## 定期自动删除垃圾邮件"
      },
      "typeVersion": 1
    },
    {
      "id": "86749abf-16c8-4406-9394-b22a384b4e89",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -280,
        140
      ],
      "parameters": {
        "color": 7,
        "width": 150,
        "height": 200,
        "content": "## :point_up: 请更新我"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "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
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

初级 - 其他

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
初级
节点数量5
分类1
节点类型3
难度说明

适合 n8n 新手,包含 1-5 个节点的简单工作流

外部链接
在 n8n.io 查看

分享此工作流