Building Dynamic CC Array for MailerSend in Make.com

Hello,

I’m integrating a MailerSend “Send Email” module in Make.com. A webhook sends up to ten separate fields (email1email10) that should populate the CC field. Each of those fields may be empty, and their order is fixed by the webhook.

My goal is to transform the non-empty fields into a proper MailerSend CC array—i.e., a list of objects where each object has the email key. I attempted to achieve this by combining Make’s functions (toCollection, add, and array) to construct the list dynamically. Unfortunately, every version I build fails:

  • Sometimes the literal email address is treated as a key instead of the value.

  • Other times the returned array is empty even when valid email addresses are present.

I’ve tried several formula variations, but I still can’t produce a valid CC array that MailerSend accepts.

Could you advise on the correct approach—or point me to a reliable pattern—for dynamically creating a CC recipient array from multiple optional email fields in Make.com?

Thank you for your help.

We’d love to help, however, you have not provided sufficient information to demonstrate the problem that would allow us to reproduce the scenario and any issue/s and/or error/s.

To allow others to assist you with your scenario, please provide the following:

1. All Relevant Screenshots

We need to see what you’re working with to give you the best advice. Screenshots are extremely important because Make is a visual editor — a picture provides us with more context.

It would help us identify the issue by having screenshots of:

  • the full scenario,
  • any error messages,
  • individual module fields,
  • relevant filter settings (conditions), and
  • each module’s output bundles
  • any external services (spreadsheet headers, sample data, regex101.com, etc.)

You can upload images here using the Upload icon in the text editor:

We would appreciate it if you could upload screenshots here instead of linking to them outside of the forum. This allows us to zoom in on the image when clicked, and avoid tracking cookies from third-party websites.

2. Scenario Blueprint

Please export the scenario blueprint. Providing your scenario blueprint file will allow others to quickly recreate and see how you have set up the mappings in each module, and also allows us take screenshots or provide module exports of any solutions we have for you in return - this would greatly benefit you in implementing our suggestions as you can simply paste module exports back into your scenario editor!

To export your scenario blueprint, click the three dots at the bottom of the editor then choose ‘Export Blueprint’.

You can upload the file here by clicking on this button:

3. Module Output Bundles

Please provide the output bundles of each of the relevant modules by running the scenario (you can also get this without re-running your scenario from the History tab).

Click on the white speech bubbles on the top-right of each module and select “Download input/output bundles”.

A. Upload as a Text File

Save each bundle contents in a plain text editor (without formatting) as a bundle.txt file.

You can upload the file here by clicking on this button:

B. Insert as Formatted Code Block

If you are unable to upload files on this forum, alternatively you can paste the formatted bundles.
Here are some ways to provide text content in a way that it won’t be modified by the forum.

  • Method 1: Type code fence manually
    Add three backticks ``` in a separate line before and after the content, like this,

    ```
    text goes here
    ```
    
  • Method 2: Highlight and click the “preformatted text” button in the editor

  • Method 3: Upload your file and share the public link
    (this method is only recommended for large files exceeding the forum upload limit)

Providing the input/output bundles will allow others to replicate what is going on in the scenario, especially if there are complex data structures (nested arrays and collections) or if external services are involved, and help you with mapping the raw property names from collections.

Sharing these details will make it easier for others to assist you.

Hi,

I prepared a small scenario that shows what I’m trying to achieve.

  • The webhook/module returns up to 10 flat email fields (email1email10). Some may be empty (e.g., email3 has no value).

  • I need two outputs:

    1. a comma-separated string with only the non-empty emails — this works;

    2. an array/list of objects like { "email": "<address>" } to map to MailerSend’s CC field.

When I try to build the array dynamically in Make, the formula either returns an empty result or treats the email value as a key. I haven’t been able to find a working formula. I’ve tried multiple approaches (using toCollection, add, array, and conditional filters), but I still get an empty array or a mis-keyed structure.

Could you point me to a reliable pattern or example for creating the CC array from these optional fields?

{{add(emptyarray; if(length(trim(1.email1) > 0); toCollection("email"; 1.email1; ); emptyarray))}}

Thank you.

Integration Tools.blueprint (1).json (17.5 KB)

{{toCollection(9.list_of_emails_where_not_empty; “email”; “email”)}}

This is the best I can achieve but still i am not able to make keys say “email“

I would really prefer to be able to do in inline but I have make it happen with 4 modules.

1.) Make a list with existing not empty emails

2.) Iterate over the list

3.) use set variable name it “email“ and take value from iterator

4.) Aggregate

5.) Use it in MailerSend

1 Like

Yes, that is possible. You’ll need a minimum of one module:

Output

This is just an example. Your final solution may or may not look like this depending on your requirements.

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

@samliew

1 Like