I have not tested this in a long time, and I don’t have time to do it right now, but see if this helps you in the right direction
[
{
"id": "8d4e7cd9.9ebca",
"type": "comment",
"z": "584092c4.71933c",
"name": "Send email with File Attachment",
"info": "",
"x": 210,
"y": 320,
"wires": []
},
{
"id": "e7ad8ab5.4947a8",
"type": "array-loop",
"z": "584092c4.71933c",
"name": "Loop each attachment",
"key": "key",
"keyType": "msg",
"reset": true,
"resetValue": "value-null",
"array": "attachments",
"arrayType": "msg",
"x": 500,
"y": 380,
"wires": [
[
"19e174b1.614c2b"
],
[
"cfbb8400.b85f78"
]
]
},
{
"id": "dc937ad2.c27888",
"type": "debug",
"z": "584092c4.71933c",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"x": 910,
"y": 400,
"wires": []
},
{
"id": "972dfe3d.5742a",
"type": "api upload file",
"z": "584092c4.71933c",
"filename": "filename",
"filenametype": "msg",
"content": "payload",
"contenttype": "msg",
"mimeType": "",
"mimeTypetype": "str",
"entity": "entity",
"entitytype": "msg",
"name": "",
"x": 440,
"y": 440,
"wires": [
[
"e7ad8ab5.4947a8"
]
]
},
{
"id": "cfbb8400.b85f78",
"type": "function",
"z": "584092c4.71933c",
"name": "prepare for upload of file",
"func": "msg.filename = msg.payload.filename;\nmsg.payload = msg.payload.content;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 230,
"y": 440,
"wires": [
[
"972dfe3d.5742a"
]
]
},
{
"id": "3fcd9b3b.d38d74",
"type": "function",
"z": "584092c4.71933c",
"name": "save email body",
"func": "msg.body = msg.payload;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 300,
"y": 380,
"wires": [
[
"e7ad8ab5.4947a8"
]
]
},
{
"id": "19e174b1.614c2b",
"type": "function",
"z": "584092c4.71933c",
"name": "Prepare for robot",
"func": "msg.payload = {};\nmsg.payload.subject = msg.topic;\nmsg.payload.body = msg.body;\nmsg.payload.from = msg.from;\nmsg.payload.attachments = [];\nmsg.attachments.forEach(x=> {\n msg.payload.attachments.push(x.filename);\n});\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 730,
"y": 360,
"wires": [
[
"ae9fa989.0ccbe8"
]
]
},
{
"id": "2d17c9f0.f80656",
"type": "comment",
"z": "584092c4.71933c",
"name": "requires node-red-contrib-loop-processing",
"info": "",
"x": 520,
"y": 320,
"wires": []
},
{
"id": "ae9fa989.0ccbe8",
"type": "rpa workflow",
"z": "584092c4.71933c",
"queue": "5ce94386320b9ce0bc2c3d07",
"workflow": "5f0056090e65fa3607ee5c6b",
"name": "",
"x": 730,
"y": 420,
"wires": [
[
"dc937ad2.c27888"
],
[],
[
"bc27db6.4a81728"
]
]
},
{
"id": "bc27db6.4a81728",
"type": "debug",
"z": "584092c4.71933c",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "error",
"targetType": "msg",
"x": 900,
"y": 440,
"wires": []
},
{
"id": "55692341.6be72c",
"type": "e-mail in",
"z": "584092c4.71933c",
"d": true,
"name": "",
"protocol": "IMAP",
"server": "imap.gmail.com",
"useSSL": true,
"autotls": "never",
"port": "993",
"box": "INBOX",
"disposition": "None",
"criteria": "UNSEEN",
"repeat": "20",
"fetch": "auto",
"inputs": 0,
"x": 150,
"y": 380,
"wires": [
[
"3fcd9b3b.d38d74"
]
]
}
]