HIL Email node only sending 1 mail even though it's within a loop

Hi

What is the error message (if any)?

When I run my workflow that uses the send and wait for approval email node to get approval on an email, I can respond to it once and then I have an AI model afterwards, which should see the free text response and then rewrite the email and give it back to me based on that and then send it for approval again. However, when the loop restarts it always get’s stuck at the send and wait for approval node. If I reopen the first email and respond again then the node executes. How can I be sent a new email for each time I enter in something in the free text other than yes (confirming it’s good to go)?

Thanks for the help

I only put in the wait node for experimenting:

Please share your workflow

{
“nodes”: [
{
“parameters”: {
“operation”: “sendAndWait”,
“fromEmail”: “xxxxx”,
“toEmail”: “xxxxxx”,
“subject”: “= {{ $(‘Email Request’).item.json.subject }}”,
“message”: “={{ $(‘Email Request’).item.json.body }}”,
“responseType”: “freeText”,
“options”: {}
},
“type”: “n8n-nodes-base.emailSend”,
“typeVersion”: 2.1,
“position”: [
940,
620
],
“id”: “xxxxxxxxxxxxxxx”,
“name”: “Send Email”,
“webhookId”: “xxxxxxxxxxxxxxxxxxx”,
“credentials”: {
“smtp”: {
“id”: “xxxxxx”,
“name”: “SMTP account”
}
}
},
{
“parameters”: {
“conditions”: {
“options”: {
“caseSensitive”: true,
“leftValue”: “”,
“typeValidation”: “strict”,
“version”: 2
},
“conditions”: [
{
“id”: “76741b7f-a9e6-4d3b-9e49-86cafdb352b2”,
“leftValue”: “={{ $json.data.text }}”,
“rightValue”: “y”,
“operator”: {
“type”: “string”,
“operation”: “equals”,
“name”: “filter.operator.equals”
}
}
],
“combinator”: “and”
},
“options”: {}
},
“type”: “n8n-nodes-base.if”,
“typeVersion”: 2.2,
“position”: [
1180,
760
],
“id”: “0012ec55-2366-45c8-ab7d-ea05bb12093f”,
“name”: “If”
},
{
“parameters”: {
“promptType”: “define”,
“text”: “=You are a personal assistant tasked on rewriting the email based on the user input from the previous input\n\nThis is the mail:\n{{ $(‘Edit Fields’).item.json.Email }}\n\nThis is the user’s instruction: \n{{ $(‘Send Email’).item.json.data.text }}\n\nIMPORTANT: ONLY OUTPUT THE EMAIL SO IT’S READY TO BE SENT NO OTHER COMMENTS”,
“options”: {}
},
“type”: “@n8n/n8n-nodes-langchain.agent”,
“typeVersion”: 1.9,
“position”: [
1400,
860
],
“id”: “1fa6b13c-63a6-4b99-ae5c-030f55d5c119”,
“name”: “AI Agent”
},
{
“parameters”: {
“model”: “gemma3:4b”,
“options”: {}
},
“type”: “@n8n/n8n-nodes-langchain.lmChatOllama”,
“typeVersion”: 1,
“position”: [
1440,
1080
],
“id”: “01e4bf92-8ceb-4865-9b21-c93c149aa2ae”,
“name”: “Ollama Chat Model”,
“credentials”: {
“ollamaApi”: {
“id”: “AzcES2rMQWfV5Y6k”,
“name”: “Ollama account”
}
}
},
{
“parameters”: {
“sessionIdType”: “customKey”,
“sessionKey”: “my_test_session”,
“contextWindowLength”: 10
},
“type”: “@n8n/n8n-nodes-langchain.memoryBufferWindow”,
“typeVersion”: 1.3,
“position”: [
1600,
1080
],
“id”: “8287768c-4f6f-40ad-b93d-6ece9a1995e5”,
“name”: “Simple Memory”
},
{
“parameters”: {
“assignments”: {
“assignments”: [
{
“id”: “0aa81929-cd35-4828-80f4-55001a0be0d3”,
“name”: “Email”,
“value”: “={{ $json.email }}”,
“type”: “string”
}
]
},
“options”: {}
},
“type”: “n8n-nodes-base.set”,
“typeVersion”: 3.4,
“position”: [
440,
620
],
“id”: “1ce2fbbf-ef8a-484d-89a3-b720d80b0083”,
“name”: “Edit Fields”
},
{
“parameters”: {
“assignments”: {
“assignments”: [
{
“id”: “2b081eba-bc82-4eaf-bdd8-e69c0153a9d9”,
“name”: “email”,
“value”: “={{ $json.output }}”,
“type”: “string”
}
]
},
“options”: {}
},
“type”: “n8n-nodes-base.set”,
“typeVersion”: 3.4,
“position”: [
1760,
860
],
“id”: “60335a7e-2370-451e-938c-ca7133e2a2cf”,
“name”: “Edit Fields2”
},
{
“parameters”: {
“amount”: 2,
“unit”: “minutes”
},
“type”: “n8n-nodes-base.wait”,
“typeVersion”: 1.1,
“position”: [
660,
620
],
“id”: “393e2527-81fb-4688-956d-7cbe4d2f37aa”,
“name”: “Wait”,
“webhookId”: “xxxxxxxxxxxxxxxxxxxxxxxxxx”
}
],
“connections”: {
“Send Email”: {
“main”: [
[
{
“node”: “If”,
“type”: “main”,
“index”: 0
}
]
]
},
“If”: {
“main”: [
,
[
{
“node”: “AI Agent”,
“type”: “main”,
“index”: 0
}
]
]
},
“AI Agent”: {
“main”: [
[
{
“node”: “Edit Fields2”,
“type”: “main”,
“index”: 0
}
]
]
},
“Ollama Chat Model”: {
“ai_languageModel”: [
[
{
“node”: “AI Agent”,
“type”: “ai_languageModel”,
“index”: 0
}
]
]
},
“Simple Memory”: {
“ai_memory”: [
[
{
“node”: “AI Agent”,
“type”: “ai_memory”,
“index”: 0
}
]
]
},
“Edit Fields”: {
“main”: [
[
{
“node”: “Wait”,
“type”: “main”,
“index”: 0
}
]
]
},
“Edit Fields2”: {
“main”: [
[
{
“node”: “Edit Fields”,
“type”: “main”,
“index”: 0
}
]
]
},
“Wait”: {
“main”: [
[
{
“node”: “Send Email”,
“type”: “main”,
“index”: 0
}
]
]
}
},
“pinData”: {},
“meta”: {
“instanceId”: “c4d888a6c7a57536c04fcf7293d2a471d0d98b93b6ae47ff133345f08478f0d4”
}
}

Share the output returned by the last node

Information on your n8n setup

  • **n8n_version:1.94.1
  • **Database (default: SQLite):SQLite
  • **n8n EXECUTIONS_PROCESS setting (default: own, main):tool call
  • **Running n8n via (Docker, npm, n8n cloud, desktop app):Docker
  • **Operating system:Windows

Hi there, i hope im getting your issue right

but have you tried using the for loop items node for the looping?

put it before sending the email, it will then pass ur items 1 by 1 to be triggered with the rest of your workflow

Hi,

thanks for the help.

I added a loop. The issue is that I’m not getting sent a new email with each loop, but rather the first email is still active and I can add comments that continues the workflow and starts a new loop, but I never get a new email with the up to date message:

Does that make sense?

I tried to copy and paste your workflow but it didn’t seem to work. It would be helpful if the workflow was shared propertly so we can look at it in n8n

here is the JSON, the onyl thing I removed were the email addresses

{
“name”: “Email-agent HIL”,
“nodes”: [
{
“parameters”: {
“content”: “## Email Approval Workflow\nThis workflow handles email drafting with human-in-the-loop approval using Protonmail Bridge.\n\n1. AI Agent provides email details\n2. Draft is sent for approval\n3. If approved (empty reply), email is sent\n4. If rejected (reply with comments), feedback is sent back to AI”,
“height”: 255.99999237060547,
“width”: 784.9999809265137,
“color”: 4
},
“id”: “347dedaf-fe92-4bad-bca4-e7a31f396d6b”,
“name”: “Workflow Description”,
“type”: “n8n-nodes-base.stickyNote”,
“typeVersion”: 1,
“position”: [
0,
240
]
},
{
“parameters”: {
“workflowInputs”: {
“values”: [
{
“name”: “to”
},
{
“name”: “subject”
},
{
“name”: “body”
},
{
“name”: “attachments”,
“type”: “array”
}
]
}
},
“id”: “a8d301d7-1c51-4b2a-8b37-7abf21072798”,
“name”: “Email Request”,
“type”: “n8n-nodes-base.executeWorkflowTrigger”,
“typeVersion”: 1.1,
“position”: [
0,
540
]
},
{
“parameters”: {
“operation”: “sendAndWait”,
“fromEmail”: “test”,
“toEmail”: “test”,
“subject”: “= {{ $(‘Email Request’).item.json.subject }}”,
“message”: “={{ $(‘Email Request’).item.json.body }}”,
“responseType”: “freeText”,
“options”: {}
},
“type”: “n8n-nodes-base.emailSend”,
“typeVersion”: 2.1,
“position”: [
1380,
620
],
“id”: “7132676c-381b-49c8-a401-e54d7c5dd74f”,
“name”: “Send Email”,
“webhookId”: “96319013-14fa-4e63-9be0-8bdef13c238f”,
“credentials”: {
“smtp”: {
“id”: “woDDb6e5pBAkfjpA”,
“name”: “SMTP account”
}
}
},
{
“parameters”: {
“conditions”: {
“options”: {
“caseSensitive”: true,
“leftValue”: “”,
“typeValidation”: “strict”,
“version”: 2
},
“conditions”: [
{
“id”: “76741b7f-a9e6-4d3b-9e49-86cafdb352b2”,
“leftValue”: “={{ $json.data.text }}”,
“rightValue”: “y”,
“operator”: {
“type”: “string”,
“operation”: “equals”,
“name”: “filter.operator.equals”
}
}
],
“combinator”: “and”
},
“options”: {}
},
“type”: “n8n-nodes-base.if”,
“typeVersion”: 2.2,
“position”: [
1620,
760
],
“id”: “0012ec55-2366-45c8-ab7d-ea05bb12093f”,
“name”: “If”
},
{
“parameters”: {
“promptType”: “define”,
“text”: “=You are a personal assistant tasked on rewriting the email based on the user input from the previous input\n\nThis is the mail:\n{{ $(‘Edit Fields’).item.json.Email }}\n\nThis is the user’s instruction: \n{{ $(‘Send Email’).item.json.data.text }}\n\nIMPORTANT: ONLY OUTPUT THE EMAIL SO IT’S READY TO BE SENT NO OTHER COMMENTS”,
“options”: {}
},
“type”: “@n8n/n8n-nodes-langchain.agent”,
“typeVersion”: 1.9,
“position”: [
1840,
860
],
“id”: “1fa6b13c-63a6-4b99-ae5c-030f55d5c119”,
“name”: “AI Agent”
},
{
“parameters”: {
“model”: “gemma3:4b”,
“options”: {}
},
“type”: “@n8n/n8n-nodes-langchain.lmChatOllama”,
“typeVersion”: 1,
“position”: [
1880,
1080
],
“id”: “01e4bf92-8ceb-4865-9b21-c93c149aa2ae”,
“name”: “Ollama Chat Model”,
“credentials”: {
“ollamaApi”: {
“id”: “AzcES2rMQWfV5Y6k”,
“name”: “Ollama account”
}
}
},
{
“parameters”: {
“sessionIdType”: “customKey”,
“sessionKey”: “my_test_session”,
“contextWindowLength”: 10
},
“type”: “@n8n/n8n-nodes-langchain.memoryBufferWindow”,
“typeVersion”: 1.3,
“position”: [
2040,
1080
],
“id”: “8287768c-4f6f-40ad-b93d-6ece9a1995e5”,
“name”: “Simple Memory”
},
{
“parameters”: {
“assignments”: {
“assignments”: [
{
“id”: “0aa81929-cd35-4828-80f4-55001a0be0d3”,
“name”: “Email”,
“value”: “={{ $json.email }}”,
“type”: “string”
}
]
},
“options”: {}
},
“type”: “n8n-nodes-base.set”,
“typeVersion”: 3.4,
“position”: [
440,
620
],
“id”: “1ce2fbbf-ef8a-484d-89a3-b720d80b0083”,
“name”: “Edit Fields”
},
{
“parameters”: {
“assignments”: {
“assignments”: [
{
“id”: “971143b0-c772-45bd-a3fa-b5ec410b3452”,
“name”: “email”,
“value”: “={{ $json.body }}”,
“type”: “string”
}
]
},
“options”: {}
},
“type”: “n8n-nodes-base.set”,
“typeVersion”: 3.4,
“position”: [
220,
540
],
“id”: “b7b0b6f4-9da5-4112-873c-c9d00d3a48ca”,
“name”: “Edit Fields1”
},
{
“parameters”: {
“assignments”: {
“assignments”: [
{
“id”: “2b081eba-bc82-4eaf-bdd8-e69c0153a9d9”,
“name”: “email”,
“value”: “={{ $json.output }}”,
“type”: “string”
}
]
},
“options”: {}
},
“type”: “n8n-nodes-base.set”,
“typeVersion”: 3.4,
“position”: [
2200,
860
],
“id”: “60335a7e-2370-451e-938c-ca7133e2a2cf”,
“name”: “Edit Fields2”
},
{
“parameters”: {
“options”: {
“reset”: true
}
},
“type”: “n8n-nodes-base.splitInBatches”,
“typeVersion”: 3,
“position”: [
1100,
600
],
“id”: “c941841e-56c2-4dfb-9ef3-2ea2dc787b29”,
“name”: “Loop Over Items”
},
{
“parameters”: {
“conditions”: {
“options”: {
“caseSensitive”: true,
“leftValue”: “”,
“typeValidation”: “strict”,
“version”: 2
},
“conditions”: [
{
“id”: “3e0a5cc0-f370-444e-88f3-285732753118”,
“leftValue”: “={{ $(‘Send Email’).item.json.data.text }}”,
“rightValue”: “y”,
“operator”: {
“type”: “string”,
“operation”: “equals”
}
}
],
“combinator”: “or”
},
“options”: {}
},
“type”: “n8n-nodes-base.if”,
“typeVersion”: 2.2,
“position”: [
660,
620
],
“id”: “447f5552-cba0-4612-9201-3157f7af6c9c”,
“name”: “If1”,
“onError”: “continueRegularOutput”
}
],
“pinData”: {
“Email Request”: [
{
“json”: {
“to”: “xxxxx”,
“subject”: “Inquiry About Cost for 2 Fillings and Availability”,
“body”: “Hi,\n\nI’m inquiring about the cost for two fillings and the availability of your services. Could you please provide details on the pricing and availability dates?\n\nThank you for your time.\nBest regards,\n[Your Name]”,
“attachments”: null
}
}
]
},
“connections”: {
“Email Request”: {
“main”: [
[
{
“node”: “Edit Fields1”,
“type”: “main”,
“index”: 0
}
]
]
},
“Send Email”: {
“main”: [
[
{
“node”: “If”,
“type”: “main”,
“index”: 0
}
]
]
},
“If”: {
“main”: [
,
[
{
“node”: “AI Agent”,
“type”: “main”,
“index”: 0
}
]
]
},
“Ollama Chat Model”: {
“ai_languageModel”: [
[
{
“node”: “AI Agent”,
“type”: “ai_languageModel”,
“index”: 0
}
]
]
},
“Simple Memory”: {
“ai_memory”: [
[
{
“node”: “AI Agent”,
“type”: “ai_memory”,
“index”: 0
}
]
]
},
“AI Agent”: {
“main”: [
[
{
“node”: “Edit Fields2”,
“type”: “main”,
“index”: 0
}
]
]
},
“Edit Fields”: {
“main”: [
[
{
“node”: “If1”,
“type”: “main”,
“index”: 0
}
]
]
},
“Edit Fields1”: {
“main”: [
[
{
“node”: “Edit Fields”,
“type”: “main”,
“index”: 0
}
]
]
},
“Edit Fields2”: {
“main”: [
[
{
“node”: “Edit Fields”,
“type”: “main”,
“index”: 0
}
]
]
},
“Loop Over Items”: {
“main”: [
,
[
{
“node”: “Send Email”,
“type”: “main”,
“index”: 0
}
]
]
},
“If1”: {
“main”: [
[
{
“node”: “Loop Over Items”,
“type”: “main”,
“index”: 0
}
],
[
{
“node”: “Loop Over Items”,
“type”: “main”,
“index”: 0
}
]
]
}
},
“active”: true,
“settings”: {
“executionOrder”: “v1”
},
“versionId”: “0adf9683-016f-490d-ba54-d3630c04882d”,
“meta”: {
“templateCredsSetupCompleted”: true,
“instanceId”: “c4d888a6c7a57536c04fcf7293d2a471d0d98b93b6ae47ff133345f08478f0d4”
},
“id”: “D1g2Mr3fHn3GsaAC”,
“tags”:
}

Sorry, that’s not valid json, it does not import into n8n. If you paste it inside of a code block using the button in the editor here: </> If it’s valid json your workflow will display in the message.

Here is an example: