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 / Capture Email addresse...
Power Automate
Answered

Capture Email addresses from an Email body into an array

(0) ShareShare
ReportReport
Posted on by 1,121

I have several email addresses of different domains in an email body. Mainly in To, From and Cc sections. I would like to parse the email body and get all email addresses into an array? Can someone help me with the hint or steps to do it. I am aware of string functions in Power Automate but not sure of how to start with it.

Categories:
I have the same question (0)
  • Verified answer
    v-yiwenxie-msft Profile Picture
    Microsoft Employee on at

    Hi @RameshMukka 

     

    In my understanding, you want to get the email addresses in To, From and Cc sections into an array.

     

    If I’ve misunderstood your need, please feel free to let me know.

     

    I’ve created a flow as below:

     

    Because email addresses in To, From and Cc sections are stored as string type.

     

    So, first, you can use concat() to connect those email addresses with “;”.

     

    Then, check if Cc section is empty. If empty, only connect email addresses in To, From sections. If not empty, connect email addresses in To, From and Cc sections.

     

    Last, convert the string containing all email addresses to array.

     

    The whole flow is as below:
    2.4-8.PNG

     

    The detailed steps for apply to each are:

    2.4-9.PNG

     

    The functions are:

    empty(items('Apply_to_each')?['ccRecipients'])

    concat(items('Apply_to_each')?['from'],';',items('Apply_to_each')?['toRecipients'],';',items('Apply_to_each')?['ccRecipients'])

    concat(items('Apply_to_each')?['from'],';',items('Apply_to_each')?['toRecipients'])

    split(variables('emails'),';')

     

    The output is:

    2.4-10.png

     

    Best Regards,
    Community Support Team _ Kira Xie
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • Verified answer
    rameshmukka Profile Picture
    1,121 on at

    @v-yiwenxie-msft Thank you for your time and solution. And sorry for coming late here. I think I haven't framed my question more precisely? Requirement was to get all email addresses from the body of the email. The body can contain a conversation between several people, I was referring email address of all those. I have figured out the solution myself during this time.

     

    Convert Email body to plain text

    RameshMukka_0-1613208441578.png

    Update my planner task description with convert body text

    RameshMukka_1-1613208568630.png

    I am now splitting my task description using newline character

    split(body('Update_task_details')?['description'],decodeUriComponent('%0A'))

    RameshMukka_2-1613208647340.png

    I only want email addresses from "From:" section of the body. I can also take Cc and To if I would like to.

    RameshMukka_3-1613208736166.png

    I only want client email, it can be any. So I am just removing vendor email addresses

    RameshMukka_4-1613208846793.png

    Now I am getting client email using below formula

    if(not(empty(body('Filter_Client_Email')?[0])),first(split(last(split(body('Filter_Client_Email')?[0],'<')),'>')),'Client domain not found')

    RameshMukka_5-1613208936377.png

     

    Thanks,

    Ramesh

     

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!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 283

#2
David_MA Profile Picture

David_MA 256 Super User 2026 Season 1

#3
Expiscornovus Profile Picture

Expiscornovus 225 Most Valuable Professional

Last 30 days Overall leaderboard