MS 365 Mail requires "Array of objects" - How?

Hi, I’m struggling with the Microsoft 365 Mail module. I want to send one mail to multiple recipients.

For that an array is required, so this is my setup:


However: I get an error of the mail module saying “Array of objects expected in parameter ‘toRecipients’.”

What exactly is required here? Does someone have an example? Seems like a more complex arrays is required?

Thanks a lot!

@Leo
Hi, I think the following post is helpful.

According to the above post, it appears that the following structure needs to be created.
It also says that you need to enter the ToRecipients in Map.

"toRecipients": 
[
  {
    "emailAddress": {
      "address": "test1@contoso.com"
    }
  }, 
  {
    "emailAddress": {
      "address": "test2@contoso.com"
    }
  }, 
  {
    "emailAddress": {
      "address": "test3@contoso.com"
    }
  }
]

Oh great, that’s a good insight! thanks!

However, now I’m really struggling getting to this format :confused:

My approach:
Array aggreagtor first

and setting the variable like that:


However, the result:

Is it the right approach? any chance for some more help? :pray:

My simple but “ugly” solution so far: Switch to the general E-Mail module and login with the MS account.
There a simple array of mail is good enough for multiple recipients… thanks MS :sweat_smile:

1 Like

@Leo
Sorry for the late reply. I also need to apologize for one more thing. There were some errors in the toRecipients that I pasted in my first response and I have corrected them.
The best I can come up with is to create a scenario like the blueprint below.
blueprint_createToRecipientsJson.json (17.0 KB)

It is difficult to explain in text only, so I would like you to take a look at the blueprint.
But for a brief explanation, the values of the Array Aggregator are retrieved one by one in Repeater and aggregated in Text Aggregator.
Only the last loop of Repeater has a separate branch in Router. I didn’t want to include commas, so I split the branches.
The final output of blueprint has the following structure.

  {
    "emailAddress": {
      "address": "test1@contoso.com"
    }
  }, 
  {
    "emailAddress": {
      "address": "test2@contoso.com"
    }
  }, 
  {
    "emailAddress": {
      "address": "test3@contoso.com"
    }
  }

I think it would work if you could enter the following into the Outlook module. Replace the ${output} with the value output by the Text Aggregator.

"toRecipients":[
  ${output}
]
2 Likes