Add multiple binary attachments to gmail

I am trying to attach multiple files (in this example two) to a gmail. After downloading it from Google Drive, i aggregate the binaries (as described here: Gmail integration: how to send a email with multiple attachments - #2 by n8n).
But I don’t know, how to attach the files in the gmail node.

To solve this issue,
you need to ensure that the data you are passing into the “Attachment Field Name” of the Gmail2 node is a string or an array,and that it is iterable.

You might need to use a function to transform the data into a compatible format before passing it to the Gmail2 node. Are you familiar with using functions to transform data?

You need to build a comma separated list of binary field names like this:

{{ Object.keys($binary).join(',') }}

(I redacted my example from the aggregate step simalar to your example so all you need is the Set step and the mapping on the Send Gmail node attachment param)

In your gmail step you should then have both binaries

As well as the attachments param with their names comma separated

You only need to set one attachment param

You probably dont even need the Set node, as you can directly use this in the gmail attachment option:

{{ Object.keys($binary).join(',') }}

Instead of where you tried to use “{{ $binary.data }}”

2 Likes

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