How can I send multiple email attachments

how can i send multiple email attachments. i get the attachments via get request from my crm.

Assuming you have the attachments saved in the binary properties “data1” and “data2” you would write in the “Attachments” parameter data1,data2

Ok that’s not so comfortable, I have one get request with multiple attachments

how can I iterate this attachments to add this to the send module

You do not need to iterate. The Send Email node will do it for you. As Jan mentioned before, you just have to provide the values comma separated.

Hello Ricardo, yes that’s right, but then I have to create for each attachment a http request module and that is not so dynamically, do you know what I mean? Look at my screenshot.

Not necessarily. You can put them in different items. One HTTP Requst Node will then download all of them, no matter if 1 or 100. After it, can you use a Function-Node to merge all of the different items into a single one.

ok do you have an example. i have to set the filename in the url in the api call. but how can i iterate the json[“0”] !

Here an example:

{
  "nodes": [
    {
      "parameters": {
        "functionCode": "items[0].json = [\n  {\n    name: '200'\n  },\n  {\n    name: '300'\n  },\n];\nreturn items;"
      },
      "name": "Mock Data",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        450,
        300
      ]
    },
    {
      "parameters": {
        "url": "=https://picsum.photos/{{$json[\"name\"]}}",
        "responseFormat": "file",
        "options": {}
      },
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        850,
        300
      ]
    },
    {
      "parameters": {
        "functionCode": "return items[0].json.map(item => {\n  return {\n    json: item\n  }\n});\n"
      },
      "name": "Split into Items",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        650,
        300
      ]
    },
    {
      "parameters": {
        "functionCode": "const binaryProperties = {};\nfor (let i=0;i<items.length;i++) {\n  let item = items[i];\n  binaryProperties[`data${i}`] = item.binary.data;\n}\n\nreturn [\n  {\n    json: {\n      binaryProperties: Object.keys(binaryProperties).join(','),\n    },\n    binary: binaryProperties,\n  }\n]\n"
      },
      "name": "Merge into one item",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        1050,
        300
      ]
    },
    {
      "parameters": {
        "attachments": "={{$json[\"binaryProperties\"]}}",
        "options": {}
      },
      "name": "Send Email",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 1,
      "position": [
        1250,
        300
      ]
    }
  ],
  "connections": {
    "Mock Data": {
      "main": [
        [
          {
            "node": "Split into Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "Merge into one item",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split into Items": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge into one item": {
      "main": [
        [
          {
            "node": "Send Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Thanks Jan, now there is this error

sorry now it works fine, thanks for your support.

Sure, glad to hear that you got it working.

Sorry but it works only when I write harcoded the api endpoint in the url field, like table id, database id record id etc. but when I paste this nodes in the url it doesn’t work. Then comes the error 401

That was only a simple example. You have to replace the URL according to your use case with the correct fixed parts and variable parts (expressions).

Considering that you will just have one item in the Webhook-Node the variables will have to look like this:
{{ $item(0).$node["Webhook"].json["body"]["Ninox_TeamID"] }}

ok this is too hard for me. i have now simply assembled the api url in ninox
and sent it to the webhook. the filename i have then added at the end and the iteration does n8n. thanks it is now finally running.i am happy.

Happy to hear that you found a solution. Have fun!