How to send emails to multiple email addresses in the BCCs using Gmail?

I’m setting up a search in a Google Sheet where it gets a few email addresses and then I want to sent and email those email addresses using the BCC fields.

So all those email addresses should be in the BCC fields. However, I’m getting an error.

I can’t use the output of the Google Sheet as the input. To merge the bundles from the Google Sheet module, I’ve put in between an array aggregator which outputs an array with three collections. But when I add these collections into the BCC, I’m getting an error. I think it should be very simple, but I’ve tried a couple of different formulas, and they all give the same error.

Does anyone have a solution?

You do not need the “join” function there. Mapping an array is CORRECT.

However, the structure of the array variable is incorrect, until you select the correct “Target Structure Type”.

See Mapping a Specific Structure Into a Complex Field below for more information.

Combining Bundles Using Aggregators

Every result (item/record) from trigger/iterator/list/search/match modules will output a bundle. This can result in multiple bundles, which then trigger multiple operations in future modules (one operation per bundle). To “combine” multiple bundles into a single variable, you’ll need to use an aggregator of some sort.

Aggregators are modules that accumulate multiple bundles into one single bundle. An example of a commonly-used aggregator module is the Array aggregator module. The next popular aggregator is the Text Aggregator which is very flexible and can apply to many use-cases like building of JSON, CSV, HTML.

You can find out more about the other types of aggregator modules here:

Question: Which is the best aggregator do you think you’ll need for your use-case?

Mapping a Specific Structure Into a Complex Field

If you have an array of collections, in programming terms, this is called an array of objects, or an array with non-primitive data types (“complex”).

The Array Aggregator module is very powerful because it allows you to build a new complex array of collections that matches a later module’s field to map multiple items (collections) to it. Such fields initially would allow you to manually add items, but you can toggle the “Map” switch to the “on” state and map a whole array into a single field.

This is done by selecting the “Target structure type” in an Array Aggregator module.

As you can see from the above example, the “Map” toggle on complex fields are used when you have an array variable (like from an array aggregator). Other combinations of modules may also allow you to generate an array that matches a future field’s array structure, like “Aggregate to JSON + Parse JSON”, or “Create JSON + Parse JSON”, but this is an advanced topic.

Question: Are you mapping your array into a field that accepts more than one item/collection?

For more information, see “Mapping with arrays” in the Help Centre. You should also do the Make Academy, which also covers the use of Iterators & Aggregators.

Hope this helps! Let me know if there are any further questions or issues.

@samliew

@samliew Thanks for your reply.

However, I can still not seem to fix this. The only thing that I can select when I choose “Target structure type” are attachments.

And when I just select the array in the BCC field, I also get an error.

Also, when I add a text aggregator after the array aggregator, I still get an output which is not accepted by the BCC field of the Gmail module.

I still don’t manage to configure it in the right way. If you guys have some more tips, they are very welcome.

I did some more testing, and even if I put a text aggregator, I think I get the output exactly how it needs to be. But even then, it’s not accepted by Gmail, so I get the feeling that it’s more a restriction of Gmail and that you’re not able to put several email addresses in the map field of the PCC. But that’s an assumption, so yeah.

Even if I map more than one email address by hand, I still get this error.

Invalid email address in parameter ‘bcc’.

Then, when I just add more recipients manually and then press Map, the module itself puts it like the output of the text aggregator. But if I run it, I also get this error.

Is it true that you can’t send more than one email address in the BCC? Using Gmail?

If you need a comma-separated string, that’s easier.

As you are aggregating a bundle, your array currently looks like this:

[
  { "2": "LALA@ff.com" }
]

You need a map function to extract the value from the column “2” from each collection in the array, before you can join them.

You can use the built-in functions map and get to access variables within an array.

To do this, you can use the built-in function map

{{ map(complex array; key; [key for filtering]; [possible values for filtering separated by a comma]) }}

and the built-in function get (or first) —

{{ get(object or array; path) }}

so you get something that looks like this —

{{ first(map(1.array; "value")) }}
{{ first(map(1.array; "value"; "name"; "content-type")) }}

You can also combine map and join to combine the variables within an array into a single text string —

{{ join(array; delimiter) }}

e.g.:

{{ join(map(9.array; "2"); ",") }}

(copy-paste the above into the field, or type it exactly as shown)

For more information, the function’s documentation can be found in the Help Centre and the “Mapping with Arrays” link below. You should also complete the tutorials in the Make Academy, especially Using get() and map() functions.

Here are some useful links and guides you can use to learn more on how to use the Make platform, apps, and app modules. I found these useful when I was learning Make, and hope they might benefit you too —

Getting Started

Help Centre Basics

Articles & Videos

Hope this helps! Let me know if there are any further questions or issues.

@samliew

@samliew after some more trial and error, I managed to find a solution.

I used a text aggregator and used the comma separator, and after I used a split function in the Gmail module the map function on.

{{split(24.text; “,”)}}

Like this, the Gmail module seems to accept multiple email addresses.

1 Like

That’s great, and is definitely a valid alternative method of doing it!

However, I’d still recommend learning how to use the map function as you won’t be able to escape it’s use when you’re building more advanced scenarios in the future…

The Make Academy has valuable information, and it’s free!

Hope this helps! Let me know if there are any further questions or issues.

@samliew

1 Like