Skip to main content

Notifications

Power Automate - General Discussion
Unanswered

Send personal email with "Get user profile" to multiple recipients

(0) ShareShare
ReportReport
Posted on by

Hi all,

 

I'm trying to send a personal email using the "Get user profile" function to multiple recipients. I want to add dynamic content in the body of the email with "Hi [user name]". When I do so, everyone receives all the emails (e.g. I want to send a single email to 8 people, all 8 people receive 8 emails instead of 1 email!). I believe this is because the "Send an email" function is within the "Apply to each" function however when I move the "Send an email" function out from the "Apply to each" function the dynamic content to select "Get user profile" is no longer selectable, i.e. you cannot select any of the properties of the "Get user profile".

 

Any help would be appreciated! Jack

 

mccardj_0-1605300741880.png

  • Re: Send personal email with "Get user profile" to multiple recipients

    Hi, yes I think it does, but it still doesn't resolve my problem around the "Get user profile" - what would you suggest I do to fix that?

  • bibhupanigrahi Profile Picture
    bibhupanigrahi 240 on at
    Re: Send personal email with "Get user profile" to multiple recipients

    @Anonymous, you were able to use 'To Email' in the 'Get user' action inside 'Apply to each' because it evaluates to a different value in each iteration of 'Apply to Each'. In fact, that is how you are able get the output of 'Get user profile', since it wouldn't work if 'To Email' had multiple email addresses in it. So, using the 'To Email' in BCC would send only one email to each person. All 3 emails go to the email address you have explicitly mentioned in the 'To' field of 'Send an email (V2)' because that is a static value and doesn't change in each iteration of 'Apply to each'. Hope that makes sense.

  • Re: Send personal email with "Get user profile" to multiple recipients

    Hi @bibhupanigrahi ,

     

    I need to use the output of the Compose action because there are multiple people receiving the email - e.g. 3 people. If I don't use the Compose action and just input the "To Email" directly in BCC all 3 people will individually receive 3 emails, because the "To Email" will automatically be added into an "Apply to each". This is obviously not ideal.

     

    My focus is on solving for the "Get user profile", e.g. I want to send the email to 3 people: Jack, John, Jake. I want to send them a personalised email with the start directly addressing them, e.g.

     

    Email 1. "Hi Jack"

    Email 2. "Hi John"

    Email 3. "Hi Jake"

     

    The names will be an output from the "Get user profile" function, however, when I directly add the function into the email body, they receive all 3 emails rather than just the one addressed to them

     

    Hope that makes sense and thanks for your help so far! It's certainly a tricky one!

  • bibhupanigrahi Profile Picture
    bibhupanigrahi 240 on at
    Re: Send personal email with "Get user profile" to multiple recipients

    Hi @Anonymous , it seems you are using the output of a Compose action in BCC. I am not sure what you have in Compose, but you should use the dynamic value 'To Email' directly in BCC  - exactly the same value you are using inside 'Get user profile (V2).

  • Re: Send personal email with "Get user profile" to multiple recipients

    Hi @bibhupanigrahi ,

     

    Apologies - no I'm using a dynamic value for the To field, I just have it in the BCC field instead. Is it not working because I have the output in the BCC field instead of the "To" field?

     

    mccardj_0-1606463082624.png

     

  • bibhupanigrahi Profile Picture
    bibhupanigrahi 240 on at
    Re: Send personal email with "Get user profile" to multiple recipients

    Hi @Anonymous , thank you for replying. I see that you are using a static email in the 'To' field of 'Send an Email (V2)' This will result in every email going to the same address. If your intention is to send only one email to each recipient, the email address in the 'To' field of 'Send an Email (V2)' must be dynamic value that changes for each iteration of the loop. So, for the mail address, I would use the same 'To Email' value that you have used in inside the 'Get user profile (V2)' action.  

  • Re: Send personal email with "Get user profile" to multiple recipients

    Hi @bibhupanigrahi ,

     

    Thanks for your quick reply!

     

    In terms of your first point, when I tried to put "Send an email" into "Apply to each", the recipients receive 3 emails, 1 to themselves, and 2 to the others. That is obviously not the intention.

     

    If you don't think a variable is needed, I've removed it

     

    mccardj_0-1606461858585.png

     

  • bibhupanigrahi Profile Picture
    bibhupanigrahi 240 on at
    Re: Send personal email with "Get user profile" to multiple recipients

    Hi @Anonymous , glad to know the emailing issue is resolved.

     

    In Screenshot 3, I see that your 'Send an Email (V2)' is outside the 'Apply to Each 3', which means you just want to send one email to all the recipients. If you want to send a separate email to each recipient with that user's name, such as Hi @Anonymous, you will need to put 'Send an Email (V2)' inside 'Apply to Each 3'. That will send just one personalized email to each recipient. Since you are getting the user profiles inside the loop, you can access the individual Given Name only inside the loop. 

    I am not sure why you are appending the names of all recipients to a variable. Are you trying to get a single string of all the recipient names separated by commas? If yes, you need to put a space and a comma after the 'Given Name' dynamic value inside the 'append to string variable' function in Screenshot 3.

    Hope this helps.

  • Re: Send personal email with "Get user profile" to multiple recipients

    Hi @bibhupanigrahi , thanks for your email. Here's the full flow.

     

    Please Note: There is no issue with sending the email to multiple people - I have resolved that. The issue is I can't get the email to send with a specific person's name  in the email body, e.g. "Hi @bibhupanigrahi ".

    I have attempted to use the Initalise variable function but as you can see it doesn't work as expected.

     

    Here's how the flow is setup:

     

    1. Screenshot 1: Creates a "Person" array variable to extract the email address for each "To" person - this flow works perfectly. The "To" person comes from a SharePoint list with a People column, there can be multiple To people in the list.

    2. Screenshot 2: Initialize the "CombinedEmailString". Then Conditional flow, when the "Send" value changes from "No" to "Yes", the email flow starts

    3. Screenshot 3: If no, for each "To" person get the user's Given Name and then add into the body of the email, e.g. "Hi Jack"

     

    Sample Data:

     

    1.png

     

    Flow:

     

    2.png3.png4.png

     

  • bibhupanigrahi Profile Picture
    bibhupanigrahi 240 on at
    Re: Send personal email with "Get user profile" to multiple recipients

    HI @Anonymous , assuming your 'To' field used in 'Apply to Each' has multiple users and the 'Get user profile' action gets the profile details of each user, are you using the individual user's email in the 'To' field of 'Send an email (V2)'? Each email would go to all users if you use a multi-person value or group email in the 'To' field of 'Send an email (V2)'.

    If this is not the issue, could you show the content of 'To' value that you get from SharePoint and an expanded screenshot of the 'Send and email (V2)' action? 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,508

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,839

Leaderboard