Create attachment array for email sending

We have a form on our website that users can upload files to (up to 3). It is not required so sometimes there are file URLs, sometimes not. They are just a comma separated list of URLs.

So what we did was to split them into in array and then iterate over them to be able to download each file. The “Get file” module then provides file name and binary content which we both need for our attachments.

The attachment array should consist of an object for each file (containing name and binary content).

My challenge is that the aggregator only saves the last file into the array and not all. Also I only need the iterator if there is even one file attached. If not, we have none in our mail.

I am saving the array as variable in the last step to be able to access its value in the second route. This works but like I said I only have one file object in the array. Each iteration replaces the previous one.

Does anyone know how to fix it? I feel like I am missing something simple here.

Please show the settings for the upper scenario, as it looks ok but it seems like it overwrites it on every run or at the end.

Hi @NicoN!

Thank you for helping out.

I figured it out yesterday. First I needed to set the target for the aggregator on the iterator and then I could also skip the JSON module and the router before. So it is much simpler now.

Here is my current setup:

2 Likes