web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Personalize email body...
Power Automate
Answered

Personalize email body with Flow?

(0) ShareShare
ReportReport
Posted on by 6

Hey all, I've just started using flow but trying to learn as much as I can by looking through the documentation. I'm trying to create a flow that will forward an email all users within a specific department (based on the subject of the email, and whether or not it contains the department)

Is there something in flow I can use to pull the username of each corresponding user, and then have their name added to the body? I was looking through the Dynamic Content tags and couldn't find anything. Something like below:

"Hey [FIRST.NAME],

Here is the report for your department. Thanks!"

This will be the first of many personalized emails I'd like to set up with flow, and thought being able to add the user name to the body would be a nice touch.

Categories:
I have the same question (0)
  • ScottShearer Profile Picture
    25,290 Most Valuable Professional on at

    @rykiff 

    Here is something that you can try:

    • Use the IndexOf expression to evaluate the message subject in order to determine if a group name appears in the subject
    • Use the AzureAD Get Group Members action to retrieve group members
      • You'll need to loop through the members returned and then send an email
      • I believe that the group members display name and email address are both returned by Get Group Members

    I haven't had time to test the AzureAD Get Group members action but it should work for you.

     

     

     

  • v-bacao-msft Profile Picture
    Microsoft Employee on at

    Hi @rykiff ,

     

    Please refer to the following method to configure Flow.

    • Configure Search for users action to get all the users in the organization.
    • Use Apply to each to traverse the Body to determine if the Subject contains a Department. If it is included, forward an email.

    Image reference:

    21.PNG

    Please take a try.

     

    Best Regards,

  • rykiff Profile Picture
    6 on at

    Hey Scott, thanks for the reply. The IndexOf expression definitely sounds like it would be a good option -- I'm  not too familiar with flow yet, but I'll be sure to use these as a good basis for some deep research this evening. I felt that the AzureAD connector would be the most useful for my use-case scenario, but unfortunately that functionality gives me a warning stating I need administrator approval, so I'll have to check with IT to see if there's anything I can do there. 

     

    Also Barry -- I really like your flow, the logic seems easy enough to follow, so I went ahead and set it up to test myself. I keep running into an issue where on the condition 'apply each' logic loop, it takes a bit of time (maybe around 30 seconds) and then timeouts after 100 iterations. My organization has about 700 active users -- is there an alternative way to search for users who match the department condition (as specified in the email subject)? One thing I should've mentioned in my OP is that users will also be members of one of two groups; either our 'Managers' group, or our 'Directors' group (totalling about 60 users total). Is it possible to make a condition that filters these users out first, and then compare the department to those 60 users instead of my entire organization? Thanks again for the replies, excited to get this flow going.

  • Verified answer
    v-bacao-msft Profile Picture
    Microsoft Employee on at

    Hi @rykiff ,

     

    You could use Filter array to filter out the members of the corresponding department before using Apply to each.

    Alternatively, you could click on Apply to each-Settings to customize the degree of parallelism.

    Image reference:

    25.PNG26.PNG

     

    Best Regards,

  • rykiff Profile Picture
    6 on at

    Hey Barry, this is fantastic! The iteration finishes successfully now. I'm not sure if this is exactly related to departments, but is there anyway to also differentiate user membership by group? If I could take these results, and pair them with a condition that sends only if they are a member or director, my flow would be complete. Seriously though, this is awesome, thanks for all your help!

  • v-bacao-msft Profile Picture
    Microsoft Employee on at

    Hi @rykiff ,

     

    I am not sure what Group you mentioned is specifically? Office 365 group or others? User info does not seem to contain this property.

    Please provide more details so that we could provide proper workaround.

     

    Best Regards,

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 873

#2
Valantis Profile Picture

Valantis 820

#3
Haque Profile Picture

Haque 505

Last 30 days Overall leaderboard