{"product_id":"imap-email-classifier-gmail-auto-reply-with-openai-in-n8n","title":"IMAP Email Classifier \u0026 Gmail Auto-Reply with OpenAI in n8n","description":"\u003ch3\u003eAutomatically classify incoming IMAP emails and respond in Gmail—using OpenAI inside n8n\u003c\/h3\u003e\n\u003cp\u003eThis n8n workflow checks your IMAP inbox every 5 minutes, uses OpenAI to categorize unread messages, and sends a category-specific auto-reply via Gmail to the original sender—covering support, sales, complaints, account requests, and general inquiries.\u003c\/p\u003e\n\n\u003ch3\u003eWhat this workflow does\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eScheduled email intake:\u003c\/strong\u003e Runs every 5 minutes using a \u003cstrong\u003eSchedule Trigger\u003c\/strong\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eReads unread messages:\u003c\/strong\u003e Fetches up to \u003cstrong\u003e10 unread emails\u003c\/strong\u003e from the \u003cstrong\u003eIMAP INBOX\u003c\/strong\u003e (port 993 with secure enabled) and includes the email content.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eCleans and prepares the message:\u003c\/strong\u003e Extracts key fields (sender, subject, date, message ID) and strips HTML from the email body.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eOpenAI classification:\u003c\/strong\u003e Sends the cleaned body to \u003cstrong\u003eOpenAI (gpt-4o-mini)\u003c\/strong\u003e to return a \u003cstrong\u003eJSON\u003c\/strong\u003e result including \u003cstrong\u003ecategory\u003c\/strong\u003e, \u003cstrong\u003epriority\u003c\/strong\u003e, \u003cstrong\u003esentiment\u003c\/strong\u003e, \u003cstrong\u003elanguage\u003c\/strong\u003e, and a short \u003cstrong\u003esummary\u003c\/strong\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eRoutes by category:\u003c\/strong\u003e Uses category routing (SUPPORT, SALES, COMPLAINT, ACCOUNT, GENERAL) to build an appropriate reply message.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eAuto-replies with Gmail:\u003c\/strong\u003e Sends the generated reply back to the original sender using Gmail.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eUse cases\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003eSpeed up response times for \u003cstrong\u003ecustomer support\u003c\/strong\u003e and \u003cstrong\u003egeneral inquiries\u003c\/strong\u003e.\u003c\/li\u003e\n  \u003cli\u003eRoute \u003cstrong\u003esales\u003c\/strong\u003e questions to the right template automatically.\u003c\/li\u003e\n  \u003cli\u003eHandle \u003cstrong\u003ecomplaints\u003c\/strong\u003e and \u003cstrong\u003eaccount requests\u003c\/strong\u003e with consistent, policy-aligned replies.\u003c\/li\u003e\n  \u003cli\u003eReduce manual triage for SaaS operators managing multiple inbound email types.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eTechnical details\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eNodes \/ components:\u003c\/strong\u003e \u003cem\u003eSchedule Trigger\u003c\/em\u003e, \u003cem\u003eEmail Read IMAP\u003c\/em\u003e, \u003cem\u003eCode\u003c\/em\u003e, \u003cem\u003eOpenAI classification step (gpt-4o-mini)\u003c\/em\u003e, \u003cem\u003eSwitch\u003c\/em\u003e, \u003cem\u003eGmail\u003c\/em\u003e, plus \u003cem\u003eSticky Note\u003c\/em\u003e for workflow clarity.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eRequired setup:\u003c\/strong\u003e IMAP credentials (IMAP host, port 993, secure, mailbox INBOX, app password), OpenAI API key, and Gmail OAuth2 account confirmed for the sender mailbox.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eCustomization:\u003c\/strong\u003e Review and edit reply templates (tone, links, addresses, brand\/policy wording).\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003cp\u003e\u003cstrong\u003eCreated by:\u003c\/strong\u003e Opus22 — AI Transformation Consulting\u003cbr\u003e\u003ca href=\"https:\/\/opus22.substack.com\"\u003ehttps:\/\/opus22.substack.com\u003c\/a\u003e\u003c\/p\u003e","brand":"N8N Commerce","offers":[{"title":"Default Title","offer_id":45876875428019,"sku":"N8N-18506","price":54.99,"currency_code":"GBP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0749\/6279\/6723\/files\/JPlTvW5dlkG-e85Zaa378_S2xLoeQ4.png?v=1787303558","url":"https:\/\/buyflowscripts.com\/products\/imap-email-classifier-gmail-auto-reply-with-openai-in-n8n","provider":"N8N Commerce","version":"1.0","type":"link"}