8
n8n 中文网amn8n.com

AI驱动的IMAP监控与Telegram提醒及智能自动回复

高级

这是一个Ticket Management, Multimodal AI领域的自动化工作流,包含 17 个节点。主要使用 If, Telegram, EmailSend, EmailReadImap, ChainLlm 等节点。 监控邮件并通过Ollama发送AI生成的自动回复及Telegram提醒

前置要求
  • Telegram Bot Token
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "g9r4yBMwWxsupyjv",
  "meta": {
    "instanceId": "5c7ce220523e8664f49208a8be668a8dc6fab5f747ce4de865fa1309727919f1"
  },
  "name": "AI驱动的IMAP监控与Telegram提醒及智能自动回复",
  "tags": [],
  "nodes": [
    {
      "id": "c12ebb83-47fd-470b-ba67-151e1b259b82",
      "name": "无操作",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -688,
        704
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "3098bb59-a78d-4a8d-8253-466f98832ec0",
      "name": "从接收邮件发送通知",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -1376,
        464
      ],
      "webhookId": "b794d98f-8eca-41d4-a91e-1cbdd0836300",
      "parameters": {
        "text": "=📧 **Incoming Email!**\n\n👤 **Sender:** {{ $json.from }}\n📌 **Subject:** {{ $json.subject }}\n📅 **Date-Time:** {{ $json.date }}\n\n---\n_Automatic notification from IMAP (SOGo) mailbox_",
        "chatId": "=-1234567890123",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "FUXl519hpM0FsK8j",
          "name": "Telegram account"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "45c29e94-e265-4853-a20d-60a1dc099ea8",
      "name": "指定过滤为无回复",
      "type": "n8n-nodes-base.if",
      "position": [
        -1056,
        464
      ],
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json.from.value[0].address }}",
              "value2": "noreply",
              "operation": "notContains"
            },
            {
              "value1": "={{ $json.from.value[0].address }}",
              "value2": "no-reply",
              "operation": "notContains"
            },
            {
              "value1": "={{ $json.subject.toLowerCase() }}",
              "value2": "newsletter",
              "operation": "notContains"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "78483eec-fc65-432b-9e7d-d41db7588647",
      "name": "检查接收邮件 - IMAP(示例:SOGo)",
      "type": "n8n-nodes-base.emailReadImap",
      "position": [
        -1664,
        464
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "imap": {
          "id": "MjaUVsflIPR7U9E1",
          "name": "IMAP account"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "19549685-fc0a-4ed3-bcaf-8be2c946cb79",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2208,
        112
      ],
      "parameters": {
        "color": 4,
        "width": 508,
        "height": 216,
        "content": "## IMAP邮件监控与智能自动回复"
      },
      "typeVersion": 1
    },
    {
      "id": "1d5fe648-3529-41d2-a3c7-88e450be8461",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1776,
        624
      ],
      "parameters": {
        "width": 300,
        "height": 260,
        "content": "## IMAP配置"
      },
      "typeVersion": 1
    },
    {
      "id": "a03d2412-becc-4e7e-9bf3-e494177aa9db",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1488,
        208
      ],
      "parameters": {
        "width": 332,
        "height": 240,
        "content": "## TELEGRAM通知"
      },
      "typeVersion": 1
    },
    {
      "id": "9ba3905c-85e1-41ed-999f-82b0d519a7f8",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1152,
        624
      ],
      "parameters": {
        "width": 296,
        "height": 260,
        "content": "## 垃圾邮件过滤逻辑"
      },
      "typeVersion": 1
    },
    {
      "id": "4b3795ef-d342-4818-a343-a18070c23132",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        96
      ],
      "parameters": {
        "width": 300,
        "height": 328,
        "content": "## AI驱动的自动回复"
      },
      "typeVersion": 1
    },
    {
      "id": "a94c5eae-23f7-46cd-87d5-ef3a9be65cf2",
      "name": "便利贴5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2208,
        336
      ],
      "parameters": {
        "color": 4,
        "width": 396,
        "height": 240,
        "content": "## 所需凭据"
      },
      "typeVersion": 1
    },
    {
      "id": "0074dcf8-3b77-416b-912c-b1c91f42ad4c",
      "name": "便签 6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -480,
        48
      ],
      "parameters": {
        "width": 300,
        "height": 372,
        "content": "## AI响应生成"
      },
      "typeVersion": 1
    },
    {
      "id": "71246042-ba4d-4767-bf42-247ce4998014",
      "name": "便签 7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -480,
        800
      ],
      "parameters": {
        "width": 300,
        "height": 300,
        "content": "## OLLAMA模型配置"
      },
      "typeVersion": 1
    },
    {
      "id": "e3d171cc-c71a-4c82-acaf-1605e9ba38d3",
      "name": "便签8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        272,
        640
      ],
      "parameters": {
        "width": 300,
        "height": 296,
        "content": "## 响应确认"
      },
      "typeVersion": 1
    },
    {
      "id": "82d9e05d-8cb2-46fb-9a05-825b6ab9cb85",
      "name": "Ollama 模型",
      "type": "@n8n/n8n-nodes-langchain.lmOllama",
      "position": [
        -416,
        672
      ],
      "parameters": {
        "model": "llama3.1:bf230501",
        "options": {
          "numCtx": 4096
        }
      },
      "credentials": {
        "ollamaApi": {
          "id": "jeSH4rNDYlNisYoF",
          "name": "Ollama account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "0c1d9daa-3981-4918-872b-d6e121f8d23c",
      "name": "基础LLM链",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        -416,
        448
      ],
      "parameters": {
        "text": "=Read the original email and identify its main topic or subject in 2-4 words maximum.\n\nORIGINAL EMAIL:\n{{ $('IMAP Email').item.json.textPlain }}\n\nReturn only this response, filling in the [TOPIC]:\n\nDear Correspondent! \nThank you for your message regarding [TOPIC]. \nI will respond with a personal message as soon as possible. \nHave a nice day!\n\nRULES:\n- Replace [TOPIC] with 2-4 words summarizing the email subject\n- Keep it simple and generic (e.g., \"your inquiry\", \"the project\", \"your request\")\n- Return ONLY the email text above\n- Do NOT add explanations or extra content",
        "batching": {},
        "messages": {
          "messageValues": [
            {
              "message": "You are an email response assistant."
            }
          ]
        },
        "promptType": "define"
      },
      "executeOnce": true,
      "notesInFlow": false,
      "retryOnFail": false,
      "typeVersion": 1.7,
      "alwaysOutputData": false
    },
    {
      "id": "1905aad8-dcd2-49dc-83ea-c93f3b9d4737",
      "name": "在SMTP中发送自动回复(示例POSTFIX)",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        80,
        448
      ],
      "webhookId": "5604120a-d9ba-484c-a1bf-38cf82b845af",
      "parameters": {
        "text": "={{ $json.text }}",
        "options": {
          "allowUnauthorizedCerts": true
        },
        "subject": "=Re: {{ $('Check Incoming Emails - IMAP (example: SOGo)').item.json.subject }}",
        "toEmail": "={{ $('Check Incoming Emails - IMAP (example: SOGo)').item.json.from }}",
        "fromEmail": "={{ $('Check Incoming Emails - IMAP (example: SOGo)').item.json.to }}"
      },
      "credentials": {
        "smtp": {
          "id": "YZ1Qjflyn16Ux4IA",
          "name": "SMTP account"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "d3a996dd-465f-46c7-acdd-1d0d1358a8bb",
      "name": "从响应发送通知",
      "type": "n8n-nodes-base.telegram",
      "position": [
        80,
        672
      ],
      "webhookId": "b961caf3-fdec-4204-b8ee-a26ffebf9c9b",
      "parameters": {
        "text": "=📧 **Auto-Response Sent!**\n\n👤 **Sender:** {{ $json.from }}\n📌 **Subject:** {{ $json.subject }}\n📅 **Date-Time:** {{ $json.date }}\n\n**Response:** {{ $('Basic LLM Chain').item.json.text }}\n",
        "chatId": "=-1234567890123",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "FUXl519hpM0FsK8j",
          "name": "Telegram account"
        }
      },
      "typeVersion": 1.1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "1b586248-021d-4cdd-bed4-86bf918e61aa",
  "connections": {
    "Ollama Model": {
      "ai_languageModel": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Basic LLM Chain": {
      "main": [
        [
          {
            "node": "Send Auto-Response in SMTP (example POSTFIX)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Dedicate Filtering As No-Response": {
      "main": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Operation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Notification from Incoming Email": {
      "main": [
        [
          {
            "node": "Dedicate Filtering As No-Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Incoming Emails - IMAP (example: SOGo)": {
      "main": [
        [
          {
            "node": "Send Notification from Incoming Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Auto-Response in SMTP (example POSTFIX)": {
      "main": [
        [
          {
            "node": "Send Notification from Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 工单管理, 多模态 AI

需要付费吗?

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

工作流信息
难度等级
高级
节点数量17
分类2
节点类型8
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者
Vigh Sandor

Vigh Sandor

@vighsandor

I'm a DevOps engineer and automation enthusiast who builds smart, practical workflows using n8n.io. I focus on creating reliable, open-source solutions that connect tools and simplify everyday operations — whether it’s infrastructure management, workflow automation, or integrating AI into existing systems.

外部链接
在 n8n.io 查看

分享此工作流