Send an Email to a customer with multiple Email Addresses

A QuickBooks customer may have multiple emails (1 to 4 emails). I’m trying to email the customer using Gmail but I’m getting an error in the Gmail module "Missing value of required parameter ‘to’. I’ve tried many things from converting to array and mapping and splitting, etc.

How can I get the email to be sent to all the email addresses in a customer’s account?


Hey @Baruch_Pappo,

unfortunately, I’m not sure how to manually map multiple email addresses into 1 module. I also get the validation error.

Here is a solution you can implement to handle this situation.

Have a router with 4 routes. Each route would send the email to either 1,2,3, or 4 emails

Step 1: Convert that primary email to an array of emails. It appears like you would need to replace the commas with emptystrings and then split this by newline. (You may need to use a different approach depending on how they are actually separated in the output)

Step 2: Setup your filter for each route, where you would use the length of the array calculated in step1. For example filter for sending to 1 email: length(array) = 1.

Step 3: Clone your Gmail module and then map your recipients. For example if you’re in route 2 (2 emails), in the first box get(array);1, and in the second get(array);2
image

3 Likes

@Baruch_Pappo Found the better way to do this:

Setup a parse Json module like so:

Then in your email select the manual map option and enter the results of the parse json module:

I tested it and it works

4 Likes

Split your email string by commas to create an array:

Screenshot_2023-12-22_111235

Or manually add them to a new array

Screenshot_2023-12-22_111257

4 Likes

Thank you! Unfortunately, it doesn’t seem to work.

With split I get an error:


The second option is not available since the email is not separated to pick email1, email2 email3:


I think I found a solution. Using Iterator:

Step 1: split emails

Step 2: Use Iterator

Step 3: Send Emails

It didn’t work both times, because you didn’t turn on the Map function when using the array variable.

b33511329130cd2bb6a2ea068681fa70fae7ef1e

What you’re doing now is send three emails to three recipients, instead of one email with three “to” recipients.

2 Likes

Very cool…you learn something new every day. Thank you!!!

1 Like

No problem, glad I could help!

If you want to learn more about Make, you can read up in the Help Center. I also recommend doing the tutorials in the Make Academy, and learn advanced skills like how to make custom apps to any API in the Make Partner Training Portal - both have certificates for successful completion.

3 Likes