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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Read email content fro...
Power Automate
Unanswered

Read email content from body of the email, extract and create conditions or actions

(1) ShareShare
ReportReport
Posted on by

I would love to be able to create a flow that can read the body of the email not just subject or attahcments names.  Once it can read the body of the text and find key words, extract some of this content. Identify if its a date or string and create a calendar event, etc. 

 

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

    Hi @Anonymous,

     

    Could you please share an example about your scenario?

    Do you want to extract content from body of the email?

     

    I assume that the details of your incoming email as below and you want to extract the Subject and End time content from Body of the email:2.JPGI have made a test on my side and please take a try with the following workaround:

    • Add a "When a new email arrives" trigger.
    • Add a "Html to text" action, Content field set to Body dynamic content of the trigger.
    • Add a "Compose" action, Inputs set to following formula:
    • length(body('Html_to_text'))
      Add a "Compose 2" action, Inputs set to following formula:

     

    add(indexOf(body('Html_to_text'),'End time'),10)
    • Add a "Compose 3" action, Inputs set to following formula:
    • substring(body('Html_to_text'),outputs('Compose_2'),sub(outputs('Compose'),outputs('Compose_2')))
      Add a "Compose 4" action, Inputs set to following formula:
    • add(indexOf(body('Html_to_text'),'Subject'),9)
      Add a "Compose 5" action, Inputs set to following formula:
    • indexOf(body('Html_to_text'),'Start time')
      Add a "Compose 6" action, Inputs set to following formula:
    • substring(body('Html_to_text'),outputs('Compose_4'),sub(outputs('Compose_5'),outputs('Compose_4')))
      Add a "Create event (V1)" action, specify Calendar id, End time field set to output of "Compose 3" action, Start time field set to following formula:
    utcNow()

    Subject field set to output of "Compose 6" action.

     

    Image reference:3.JPG

     

    4.JPG

    The flow works successfully as below:5.JPG7.JPG

     

    6.JPG

     

    Best regards,

    Kris

     

     

     

     

     

     

     

     

  • Community Power Platform Member Profile Picture
    on at

    Kris,

     

    My apologies for the late reply. I appreciate how creative the proposed solution is!

     

     

    Thank you,

     

    JP 

  • Community Power Platform Member Profile Picture
    on at

    Thanks for the detailed desciption, I tried to run it as described above but hot the following error;

     

    The string was not recognized as a valid DateTime. There is an unknown word starting at index 10. clientRequestId: c7e6674c-5d20-458b-b65a-c692c6fef136

  • WillPage Profile Picture
    2,307 Super User 2025 Season 2 on at

    @v-xida-msft I know this is an old thread, but I found it while looking for a solution to the same problem.

     

    The difference with mine is the data I'm looking for doesn't match a nice pattern that can be easily defined by say.. add(indexof ......), 10

     

    For example the email has this data:

     

    Enquiry from: Firstname Lastname
    Email: user@gmail.com
    Phone Number: 0299999876
    First Night: Thursday, 17 January 2019
    Number of Nights: 2

     In each of these lines the number of characters to add to the indexof is different for each email.

     

    How can I use a function to grab everything between the colon and the new line, trim it and place it in a variable?

     

    I will also put this in a new thread.

  • HallieG Profile Picture
    81 on at

    Hi @Kris

     

    Can you explain how to convert this example if the details repeated, how to loop through all iterations? I have a similar case, the number of items per email does very.

     

    Outlook Calendar event details as below

    Subject: FirstTestEvent
    Start Time: 4/20/2019
    End Time: 4/21/2019

     

    Subject: SecondTestEvent
    Start Time: 4/21/2019
    End Time: 4/22/2019

     

    Subject: ThirdTestEvent
    Start Time: 4/22/2019
    End Time: 4/23/2019

     

     

     

  • WillPage Profile Picture
    2,307 Super User 2025 Season 2 on at

    @HallieGUse the Split() expression to split on 'Subj' and then run the resulting array through a for-each.

  • sxt173 Profile Picture
    7 on at

    Did you find any solutions to this? I'm trying to figure the same thing out. How to do this for data that might be a bit unstructured. For example, how do I grab whatever is between a "$" and ":" sign?

  • Brammers Profile Picture
    46 on at

    Hi! Did you ever find out how to do this? I'm facing the same issue.....

  • Yanger Profile Picture
    4 on at

    Anyone know how to do it as said in last posts here?

  • WillPage Profile Picture
    2,307 Super User 2025 Season 2 on at

    @Yanger @Brammers & @sxt173 Yes I have solved this. A long time ago I wrote a lengthy response in this thread with detailed steps and an explanation of how it all works. I spotted some typos, then did a couple of edits to fix them and it disappeared pending moderation. It has never re-appeared.

     

    Probably enough time has passed to get over this immense frustration and I can re-do it. Maybe this weekend if I remember.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard