Send email with multiple attachments

Hello, I would like to pick up several files from Ninox and send them together in 1 email. I solved the whole thing in Make with an iterator and aggregator. Unfortunately, I don’t know which nodes I have to use with N8n.

In the workflow created in N8N, he ejects the files (binary data).


Hi @mac338 ! Sorry for the delay over the Easter holidays in getting back to you.

I’m not too sure of your setup without your exact workflow, but if there are multiple attachments, you may need to separate the binary files with a comma.

For example, you might need an expression like {{ Object.keys($binary).join(',') }} . The Object.keys method would read the names, .join(‘,’) would return these as a comma separated string.

Take a look at this workflow for an example - which fires off an email that has the two separate attachments:

On the send email node I’ve just added the {{ Object.keys($binary).join(',') }} expression there, under attachments. Keep in mind you can’t have both items as data or they’ll overwrite each other! I just went with naming them attachment_0 and attachment_1.

Let me know if that helps!

This is my Workflow. The best way would be if the “Item List” node could handle binary data

Hi @mac338 - can you share the output of the Ninox node? That might help us get to the bottom of this.


[
{
"id":
640,
"sequence":
230218,
"createdAt":
"2022-07-15T09:58:23",
"createdBy":
"12342341243hdbQw",
"modifiedAt":
"2022-07-15T09:58:32",
"modifiedBy":
"32143412341234dbQw",
"fields":
{
"Bezeichnung":
"Bilddoku zu_AN-22162801_vom_2022-07-11",
"Trigger Anhang in Bildfeld":
"2022-07-15T09:58:32",
"Dokument-Auftrag":
[
401
],
"Datei":
"Bilddoku zu_AN-22162801_vom_2022-07-11.pdf",
"Dokument-Vorgang":
[
],
"Datum":
"2022-07-15",
"Kategorie":
"Bilddoku",
"Mail-Anhänge":
[
53,
55
],
"Sichtbar für alle":
true
}
},
{
"id":
645,
"sequence":
230221,
"createdAt":
"2022-07-15T10:06:41",
"createdBy":
"1234231hdbQw",
"modifiedAt":
"2022-07-15T10:06:47",
"modifiedBy":
"12342341hdbQw",
"fields":
{
"Bezeichnung":
"Rechnung_RE-220379_vom_2022-07-15",
"Dokument-Auftrag":
[
406
],
"Datei":
"Rechnung_RE-220379_vom_2022-07-15.pdf",
"Dokument-Vorgang":
[
],
"Datum":
"2022-07-15",
"Kategorie":
"Rechnung",
"Mail-Anhänge":
[
56
],
"Sichtbar für alle":
true
}
},
{
"id":
646,
"sequence":
230218,
"createdAt":
"2022-07-15T10:08:04",
"createdBy":
"12342341Jb3hdbQw",
"modifiedAt":
"2022-07-15T10:08:08",
"modifiedBy":
"1234124Jb3hdbQw",
"fields":
{
"Bezeichnung":
"Arbeitsnachweis_AN-22162801_vom_2022-07-11",
"Dokument-Auftrag":
[
407
],
"Datei":
"Arbeitsnachweis_AN-22162801_vom_2022-07-11.pdf",
"Dokument-Vorgang":
[
],
"Datum":
"2022-07-15",
"Kategorie":
"Arbeitsnachweis",
"Mail-Anhänge":
[
54,
57
],
"Sichtbar für alle":
true
}
}
]


[
{
"name":
"Bilddoku zu_AN-22162801_vom_2022-07-11.pdf",
"size":
788870,
"contentType":
"application/pdf",
"modifiedDate":
1673048388743,
"modifiedUser":
0
},
{
"name":
"Rechnung_RE-220379_vom_2022-07-15.pdf",
"size":
71087,
"contentType":
"application/pdf",
"modifiedDate":
1673048388743,
"modifiedUser":
0
},
{
"name":
"Arbeitsnachweis_AN-22162801_vom_2022-07-11.pdf",
"size":
77338,
"contentType":
"application/pdf",
"modifiedDate":
1673048388743,
"modifiedUser":
0
}
]

@mac338 Ah I see - so it looks like you’re trying to join or merge some binary data, which the item list node does not currently support. That being said, you can accomplish this with a code node. I’ve created a small workflow that can show you how to do this:

One thing to note is that the first three nodes are just simply setting up a similar data structure to what you’re looking to use, what you’ll really need to pay attention to is the final code node. It takes multiple input items and returns a single output item:

Give that a go and see if that works for you!

3 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.