Trying to use IMAP node to move email from INBOX TO Trash folder
we getting this error:
Hey @kdeugi hope all is well, welcome to the community.
Would you like to embed your workflow for us to take a look at?
@jabbson thank you for the help, i am new and not sure what embed mean ?
No problem at all, click on the embed and see a demo.
In short:
copy your workflow and then in the chat paste it (VERY IMPORTANT) between a pair of triple backquotes, like so
```
<paste here>
```
here is the code you requested and thank for your help and support. {
“nodes”: [
{
“parameters”: {
“postProcessAction”: “nothing”,
“format”: “resolved”,
“options”: {}
},
“id”: “eb06c3ee-443a-4551-87b2-35f737ff931a”,
“name”: “Email Trigger (IMAP)”,
“type”: “n8n-nodes-base.emailReadImap”,
“position”: [
-1300,
-780
],
“typeVersion”: 2,
“credentials”: {
“imap”: {
“id”: “oYULQoPHG86bAoJG”,
“name”: “IMAP account”
}
}
},
{
“parameters”: {
“conditions”: {
“options”: {
“caseSensitive”: false,
“leftValue”: “”,
“typeValidation”: “strict”,
“version”: 2
},
“conditions”: [
{
“id”: “68ff2c7d-61a1-46de-ada8-0fcd2c16b7f8”,
“leftValue”: “=subject {{ $json.subject }}”,
“rightValue”: “You made the sale for”,
“operator”: {
“type”: “string”,
“operation”: “contains”
}
}
],
“combinator”: “and”
},
“options”: {
“ignoreCase”: true
}
},
“type”: “n8n-nodes-base.filter”,
“typeVersion”: 2.2,
“position”: [
-1060,
-760
],
“id”: “2b838601-fa45-4e5e-a55e-e3b6533da3a3”,
“name”: “Filter”
},
{
“parameters”: {
“authentication”: “coreImapAccount”,
“resource”: “email”,
“operation”: “moveEmail”,
“sourceMailbox”: {
“__rl”: true,
“mode”: “list”,
“value”: “INBOX”
},
“emailUid”: “={{ $json.messageId.replace(‘<’, ‘’).replace(‘>’, ‘’) }}”,
“destinationMailbox”: {
“__rl”: true,
“value”: “Trash”,
“mode”: “list”,
“cachedResultName”: “Trash”
}
},
“type”: “n8n-nodes-imap.imap”,
“typeVersion”: 1,
“position”: [
-780,
-760
],
“id”: “111873c3-bb78-4334-9200-b34f656e4374”,
“name”: “IMAP”,
“credentials”: {
“imap”: {
“id”: “oYULQoPHG86bAoJG”,
“name”: “IMAP account”
}
}
}
],
“connections”: {
“Email Trigger (IMAP)”: {
“main”: [
[
{
“node”: “Filter”,
“type”: “main”,
“index”: 0
}
]
]
},
“Filter”: {
“main”: [
[
{
“node”: “IMAP”,
“type”: “main”,
“index”: 0
}
]
]
}
},
“pinData”: {},
“meta”: {
“templateCredsSetupCompleted”: true,
“instanceId”: “361f1e677de391c87b0a663939f339a498db6083c209271701f741a601c569e8”
}
}
@jabbson uploaded the code you requested
Unfortunately, you didn’t put the triple backquotes around it, so it ended up being just a long blob of text… anyway, I tried in my workflow and it did work for me in gmail mailbox:
@jabbson Thank for your help however it seem to me i can not find Email UID from the available variable i think this might be an issue
Can you share the input for the IMAP node? I would like to take a look at what kind of fields it contains. Copying my code would work if you are using GMAIL. If not, I am not certain, and for that I’d love to see the input.
@jabbson this is not gmail unfortunately we are using hostinger email below is the screen grab from the input
Well, on the screenshot I don’t see uid, since there is scroll, I con’t tell what else is in that input.
@jabbson here is the full copy and paste from input hope it help : list-unsubscribe
html
\n\n\n \n @media screen and (min-width:600px){.hide{display:none!important;overflow:hidden!important;max-height:0!important}.show{display:block!important;max-height:none!important}.hide_mob{display:block!important;overflow:visible!important;max-height:none!important}.floatnone{float:none!important}.floatleft{float:left!important}.floatright{float:right!important}.opacity-1{opacity: 1!important;}}.blueFix span,.blue...subject
You made the sale for P2 ADVANCED MANAGEMENT ACCOUNTING By KAPLAN PUBLISHING (Unknown code)
date
2025-06-26T16:17:22.000Z
to
value
value[0]
address
name
html
text
from
value
value[0]
address
name
eBay
html
eBay <[email protected]>
text
“eBay” [email protected]
messageId
0A67D4E2-F6E8194D905-01979BCC376E-0000000000D3B703@starship
text
========================================\nView your notifications\nRedirecting... to Facebook\nFacebook…
textAsHtml
========================================
View your notifications
https://www.facebook.com/nd/?notifications%2F&aref=1750957502259901&medium=email&mid=6387c465a5febG5b048b6463b3G6387c8ff062bdG32b&bcode=2.1750957504.AbxJU22PLaiCJNSUGbE&n_m=email%40newagedesignuk.co.uk...
value
value[0]
address
name
noreply
html
noreply <[email protected]>
text
“noreply” [email protected]
Variables and context
Why in the last output I don’t see headers from the screenshot?
For example, where is mime-version? spf? dkim?..
@jabbson Thank you for your help and support really appreciated you afford to help on this, finally i have google node and it has help my function
Using EMAIL Trigger (IMAP] function did not help to move my email so. i use Google node for reading and relabel the folder to achieve my move function