cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
LeonAtWork
Frequent Visitor

Send Email to multiple recipients from a table in a collection

Hello,

I have a collection which contains a table and in that table are a couple of E-Mail addresses.

 

ClearCollect(
    colMatrix,
    {
        Category: 1,
        Addresses: [
            "test1@email.com",
            "test2@email.com"
        ]
    },
    {
        Category: 2,
        Addresses: [
            "test2@email.com",
            "test3@email.com"
        ]
    }
);

 

Based on which Category is chosen I want to send an E-Mail to all addresses which are in the given table.

I tried it with SendEmailV2 and Concat but I couldn't get it to work. I also tried set in combination with Concat to create a variable which contains the recipients which then could be placed in SendEmailV2 but that didn't work. How do I need to setup the SendEmailV2 in order to get this working?

Any Help would be appreciated, Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions

I haven't tried this solution at the time so I can't say if it works or not but I found another one that works in my case. I assigned a variable to each email and used a switch case in order to chose the combination I need depending on the value of "var". It looks something like this:

Set(
   mailA,
   "first@mail.com"
);
Set(
   mailB,
   "first@mail.com"
);
Set(
   mailC,
   "first@mail.com"
);
Office365Outlook.SendEmailV2(
   Switch(
      var;
      1;
      mailA & ";" & mailB & ";" & mail C;
      2;
      mailB;
      3;
      mailC),
   "Subject",
   "Body"
)

 

View solution in original post

4 REPLIES 4
Chitrakant27
Resolver II
Resolver II

Hi @LeonAtWork ,

 

If you use power automate we can send email to multiple user at a time

follow this link - https://www.damobird365.com/easily-send-email-mail-merge-with-attachments/

 

If you still facing problem Ping me here ,

 

Thanks,

Chitrakant27

A solution in Powerapps would be preferred. And how would you chose between different Categories in that scenario?

@LeonAtWork 

 

Hi,

 

From Start You created Table in a Table and that is a problem for Concat Function also this is not how SharePoint Store Records so if You collect data from SharePoint to colMatrix You don't Get what You need.

 

You need data set in Records and Yes it will show a lot of category 1 in column Category but we will deal with it:

 

ClearCollect(
    colMatrix,
    {
        Category: 1,
        Addresses:"test1@email.com"
            
          
        
    },
    {
        Category: 1,
        Addresses: 
            "test2@email.com"

        
    },
        {
        Category: 2,
        Addresses: 
            "test3@email.com"

        
    },
        {
        Category: 2,
        Addresses: 
            "test4@email.com"

        
    }
);

 

Create a Dropdown and use Distinct to show only Unique values of column Category by placing to Item Property this Code

 

Distinct(colMatrix,Category)

 

We going next to create Send button in OnSelect of the button we will create variable what will be a result of Filter base of the dropdown and then we will use SendEmailV2 to Send email as below 

 

Set(
    varEmail,
    Filter(
        colMatrix,
        Category = Dropdown1.Selected.Result
    )
);
Office365Outlook.SendEmailV2(
    Concat(
        varEmail,
        Addresses,
        ";"
    ),
    "Test",
    "Body Test"
)

 

 Hope this helps


If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users to find it.

I haven't tried this solution at the time so I can't say if it works or not but I found another one that works in my case. I assigned a variable to each email and used a switch case in order to chose the combination I need depending on the value of "var". It looks something like this:

Set(
   mailA,
   "first@mail.com"
);
Set(
   mailB,
   "first@mail.com"
);
Set(
   mailC,
   "first@mail.com"
);
Office365Outlook.SendEmailV2(
   Switch(
      var;
      1;
      mailA & ";" & mailB & ";" & mail C;
      2;
      mailB;
      3;
      mailC),
   "Subject",
   "Body"
)

 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,192)