Showing results for 
Search instead for 
Did you mean: 
New Member

Extract only the text from the latest reply in an email thread when using "when a new email arrives"



Is it possible to extract only the latest response in an email thread instead of the entire body? 


For my scenario, I need to act upon each reply to an email thread with only the content from the latest response.



Community Support
Community Support

Hi @shaykalyan,


I am not sure with your scenario, do you want to get the content from the email every time a you get a reply?


Could you show me more details on your scenario for better understanding.


Best regards,

Mabel Mao

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

Hi Mabel,


Sure, I'll try to describe further what I'm after. In my scenario, I would like to use the content from the latest email response in an email thread. I know that there is the "Body" dynamic content, however, for email threads with multiple responses, the "Body" content will contain replies from earlier responses as well as the latest response.


For example, here is the Body from a new email: 



Initial mail content



Then someone replies to the thread. The dynamic Body is now:


Reply content



TO: ....

CC: ....

Subject: ...


Initial mail content



The next reply to the thread will again have all of the history from the email in the dynamic Body variable.



What I would like to get is only the latest response in the thread and not all the other responses as well. Is this possible without doing manual string manipulation? 



Not applicable

Hi, I am working on the same thing, I want to extract only the latest reply (exclude all the original body of the email). Can anyone help? Thanks!

@shaykalyan wrote:



Is it possible to extract only the latest response in an email thread instead of the entire body? 


For my scenario, I need to act upon each reply to an email thread with only the content from the latest response.





I just tried some other way and was able to get the Latest Email only. Here are the steps


  • Every Email will have a separator which can be either a Line or Multi Tab etc., for Example in Outlook / O365 You will have a line which in HTML refer to this 


<div style="border:none; border-top:solid #E1E1E1 1.0pt; padding:3.0pt 0in 0in 0in">​


  • Here is what I did, Step 1



  • Initialize Variables which we call the Delimiter, Body of the Message and Latest ResponseCapture2.JPG






  • Finally we call the split function with [0] which gives us the First Email as below. I use this 






In my case I've used a different solution.


When I get an email:



 I first convert the email body using "HTML to text" action:



An example of an email converted would be:


Test body email.




From: Paul <>
Sent: 11 November 2021 15:42
To: Mark <
Subject: Subject email test



So if I split the output from my conversion above with the word 'From:' and on the same expression I get the first element from my array ([0]) it will result on the latest email. 😀



Trim() is optional there to remove some extra spaces. 
New Member

How would you go about removing from the output, any content that is above the message body, that is automatically put in by the system generating the email? Salesforce does this when emails are received in a Case, and a notification is sent to the team that said email has been received in the Case.  Screenshot example below.  I have highlighted the text to indicate what I only want to extract from the email, regardless of how long or short the highlighted text could be. Of course, blacked out private info. Thank you for the help!  -Brad





Helpful resources

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (4,120)