8
n8n 中文网amn8n.com

Gmail MCP工作流 - AI驱动的邮件管理

中级

这是一个Ticket Management, AI Chatbot领域的自动化工作流,包含 15 个节点。主要使用 GmailTool, McpTrigger 等节点。 Gmail MCP工作流 - AI驱动的邮件管理

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

使用的节点 (15)

工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "2000c64071c20843606b95c63795bb0797c41036047055a6586498e855b96efc",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "984b6aba-c9ea-4b12-9274-c8d479c2719f",
      "name": "MCP 服务器触发器",
      "type": "@n8n/n8n-nodes-langchain.mcpTrigger",
      "notes": "🚀 MCP TRIGGER\n\nThis is the entry point for AI interactions with Gmail. The MCP (Model Context Protocol) trigger allows AI models to call any of the connected Gmail tools based on user requests.\n\nKey Features:\n• Enables natural language Gmail commands\n• Routes AI requests to appropriate Gmail operations\n• Provides context-aware email management\n• Supports complex multi-step email workflows",
      "position": [
        -1640,
        200
      ],
      "webhookId": "fe5e5e6c-07d6-48c1-a1f8-d554bae77daf",
      "parameters": {
        "path": "fe5e5e6c-07d6-48c1-a1f8-d554bae77daf"
      },
      "typeVersion": 1.1
    },
    {
      "id": "64fd5646-c65b-4142-944f-7046a745690b",
      "name": "Gmail - 发送邮件",
      "type": "n8n-nodes-base.gmailTool",
      "notes": "📧 SEND EMAIL\n\nCompose and send emails through AI commands. The AI extracts recipient, subject, and message content from natural language requests.\n\nUse Cases:\n• \"Send an email to john@example.com about the meeting\"\n• \"Compose a follow-up email to the client\"\n• \"Send a thank you note to the team\"\n\nAI Parameters:\n• To: Email recipient(s)\n• Subject: Email subject line\n• Message: Email body content",
      "position": [
        -1020,
        700
      ],
      "webhookId": "3000cd3a-79cd-4af9-949c-6f04955a725a",
      "parameters": {
        "sendTo": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('To', ``, 'string') }}",
        "message": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message', ``, 'string') }}",
        "options": {},
        "subject": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Subject', ``, 'string') }}"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "LVRUgE95PAvkE1Mc",
          "name": "Gmail account 2"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "c57c28ce-2353-4f18-b7db-91f508ebe4da",
      "name": "Gmail - 获取邮件",
      "type": "n8n-nodes-base.gmailTool",
      "notes": "📖 READ EMAIL\n\nRetrieve and read email content by message ID. Perfect for AI to analyze, summarize, or extract information from specific emails.\n\nUse Cases:\n• \"Read the latest email from Sarah\"\n• \"Get the content of message ID 123456\"\n• \"Show me the email about the project update\"\n\nReturns:\n• Full email content\n• Headers and metadata\n• Attachments information\n• Thread context",
      "position": [
        -800,
        600
      ],
      "webhookId": "305f98e4-e58c-486d-b66e-eb67fb0201a4",
      "parameters": {
        "operation": "get"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "LVRUgE95PAvkE1Mc",
          "name": "Gmail account 2"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "d164fa99-97f4-4544-8ea6-c74ae06bb2b4",
      "name": "Gmail - 标记未读",
      "type": "n8n-nodes-base.gmailTool",
      "notes": "👁️ MARK AS UNREAD\n\nMark emails as unread to ensure they get attention later. Useful for emails that need follow-up or further action.\n\nUse Cases:\n• \"Mark that important email as unread\"\n• \"I need to revisit this email later\"\n• \"Flag this message for follow-up\"\n\nBest Practices:\n• Use for emails requiring action\n• Combine with labels for better organization\n• Great for creating manual reminders",
      "position": [
        -600,
        500
      ],
      "webhookId": "0a16a6f4-f36a-4774-9229-bd2a6ed30fde",
      "parameters": {
        "operation": "markAsUnread"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "LVRUgE95PAvkE1Mc",
          "name": "Gmail account 2"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "d5712ba7-9db0-4203-b5b9-1a0ece642cce",
      "name": "Gmail - 添加标签",
      "type": "n8n-nodes-base.gmailTool",
      "notes": "🏷️ ADD LABELS\n\nOrganize emails by adding labels for better categorization and workflow management.\n\nUse Cases:\n• \"Label this email as 'Important'\"\n• \"Add 'Project-X' label to recent emails\"\n• \"Categorize this as 'Follow-up Required'\"\n\nAI Parameters:\n• Message_ID: Target email ID\n• Label_Names_or_IDs: Labels to apply\n\nTip: Use descriptive labels for AI-driven organization",
      "position": [
        -280,
        400
      ],
      "webhookId": "d2ae386f-e833-4129-ad97-94e3b3bcb950",
      "parameters": {
        "labelIds": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Label_Names_or_IDs', ``, 'string') }}",
        "messageId": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message_ID', ``, 'string') }}",
        "operation": "addLabels"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "LVRUgE95PAvkE1Mc",
          "name": "Gmail account 2"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "558332d6-5ff4-4eea-9aa1-7851ad94397e",
      "name": "Gmail - 标记已读",
      "type": "n8n-nodes-base.gmailTool",
      "notes": "✅ MARK AS READ\n\nMark emails as read to maintain inbox organization and track processed messages.\n\nUse Cases:\n• \"Mark all emails from today as read\"\n• \"I've processed this email, mark it read\"\n• \"Clean up my unread messages\"\n\nAutomation Ideas:\n• Auto-mark newsletters as read\n• Mark processed support tickets\n• Bulk mark promotional emails",
      "position": [
        -600,
        60
      ],
      "webhookId": "4c54b980-dccb-47af-b9aa-672cc0cf687c",
      "parameters": {
        "operation": "markAsRead"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "LVRUgE95PAvkE1Mc",
          "name": "Gmail account 2"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "ea878786-f87d-4734-bed0-f4d96c459593",
      "name": "Gmail - 移除标签",
      "type": "n8n-nodes-base.gmailTool",
      "notes": "🗑️ REMOVE LABELS\n\nRemove labels from emails to update categorization or clean up organization system.\n\nUse Cases:\n• \"Remove 'Urgent' label from this email\"\n• \"Clean up old project labels\"\n• \"Update email categorization\"\n\nAI Parameters:\n• Message_ID: Target email ID\n• Label_Names_or_IDs: Labels to remove\n\nWorkflow Tip: Combine with add labels for label migration",
      "position": [
        -1460,
        640
      ],
      "webhookId": "830a9b14-2bbe-4969-a3a9-fd76a8069339",
      "parameters": {
        "labelIds": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Label_Names_or_IDs', ``, 'string') }}",
        "messageId": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message_ID', ``, 'string') }}",
        "operation": "removeLabels"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "LVRUgE95PAvkE1Mc",
          "name": "Gmail account 2"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "98f2cb9e-d0a9-48a9-9b9a-26a195128180",
      "name": "Sticky Note - MCP触发器",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2020,
        -60
      ],
      "parameters": {
        "color": 5,
        "width": 689,
        "height": 424,
        "content": "## 🚀 MCP触发器说明"
      },
      "typeVersion": 1
    },
    {
      "id": "f3431de6-e652-44d0-9060-d8f320e148eb",
      "name": "Sticky Note - 发送邮件",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1180,
        840
      ],
      "parameters": {
        "width": 350,
        "height": 284,
        "content": "## 📧 发送邮件"
      },
      "typeVersion": 1
    },
    {
      "id": "763d55d6-9c23-4997-b877-594e4c89d81d",
      "name": "Sticky Note - 获取邮件",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -700,
        780
      ],
      "parameters": {
        "color": 7,
        "width": 320,
        "height": 264,
        "content": "## 📖 阅读邮件"
      },
      "typeVersion": 1
    },
    {
      "id": "7e7eb446-0483-4c47-9420-c8c9292f48c1",
      "name": "Sticky Note - 标记未读",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -400,
        580
      ],
      "parameters": {
        "width": 300,
        "height": 244,
        "content": "## 👁️ 标记未读"
      },
      "typeVersion": 1
    },
    {
      "id": "976116f9-1b9e-466c-b3cf-46aa9a484320",
      "name": "Sticky Note - 添加标签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -300,
        60
      ],
      "parameters": {
        "color": 6,
        "width": 320,
        "height": 444,
        "content": "## 🏷️ 添加标签"
      },
      "typeVersion": 1
    },
    {
      "id": "835c248d-e384-419b-a22f-9e590afa56c6",
      "name": "Sticky Note - 标记已读",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -900,
        -60
      ],
      "parameters": {
        "width": 400,
        "height": 244,
        "content": "## ✅ 标记已读"
      },
      "typeVersion": 1
    },
    {
      "id": "faae81d9-bf04-4b66-8bb4-649b22f6cd5b",
      "name": "Sticky Note - 移除标签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1640,
        780
      ],
      "parameters": {
        "width": 320,
        "height": 264,
        "content": "## 🗑️ 移除标签"
      },
      "typeVersion": 1
    },
    {
      "id": "f2da52ae-39ce-40b7-a162-4c4cb369e7f4",
      "name": "Sticky Note - 概览",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2620,
        280
      ],
      "parameters": {
        "color": 7,
        "width": 400,
        "height": 664,
        "content": "## 🎯 工作流概览"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Gmail - Get Email": {
      "ai_tool": [
        [
          {
            "node": "MCP Server Trigger",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Gmail - Mark Read": {
      "ai_tool": [
        [
          {
            "node": "MCP Server Trigger",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Gmail - Add Labels": {
      "ai_tool": [
        [
          {
            "node": "MCP Server Trigger",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Gmail - Send Email": {
      "ai_tool": [
        [
          {
            "node": "MCP Server Trigger",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Gmail - Mark Unread": {
      "ai_tool": [
        [
          {
            "node": "MCP Server Trigger",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Gmail - Remove Labels": {
      "ai_tool": [
        [
          {
            "node": "MCP Server Trigger",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 工单管理, AI 聊天机器人

需要付费吗?

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

工作流信息
难度等级
中级
节点数量15
分类2
节点类型3
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

作者
David Olusola

David Olusola

@dae221

AI automation consultant working with ambitious businesses on their most complex operational challenges. For project inquiries, reach me at david@daexai.com

外部链接
在 n8n.io 查看

分享此工作流