This topic was automatically generated from Slack. You can find the original thread here.
I want a component for microsoft outlook which will send an email. It should use the existing Send Email functionality with one change. The recipients prop will receive a multi-dimensional array and then send a separate email to each child of the parent array.
It sounds like you’re looking for a way to send emails using Microsoft Outlook and Pipedream. You can use the existing “Send Email” action for Outlook in Pipedream. To send separate emails to each recipient in a multi-dimensional array, you can modify the component code like this: ```
export default defineComponent({ props: { recipients: { type: “string[]”, label: “Recipients”, description: “Enter the recipients as a multi-dimensional array”, }, subject: { type: “string”, label: “Subject”, }, body: { type: “string”, label: “Body”, }, }, async run({ $ }) { for (const recipientGroup of this.recipients) { for (const recipient of recipientGroup) { await $.send.email({ to: recipient, subject: this.subject, text: this.body, }); } } }, });
To send emails to recipients from a child array, you can modify your code before the this.microsoftOutlook.prepareMessageBody(this) line. Assuming you have a multi-dimensional array called recipients, you can loop through the child arrays and send emails to each recipient like this: const recipients = [ ["[email1@example.com](mailto:email1@example.com)", "[email2@example.com](mailto:email2@example.com)"], ["[email3@example.com](mailto:email3@example.com)", "[email4@example.com](mailto:email4@example.com)"], ]; for (const recipientGroup of recipients) { for (const recipient of recipientGroup) { // Set the recipient email address [this.to](http://this.to) = recipient; // Prepare the message body and send the email this.microsoftOutlook.prepareMessageBody(this); } } This code will loop through each child array and send an email to each recipient within that child array. Make sure to replace the recipients variable with your actual multi-dimensional array of recipients.