Showing results for 
Search instead for 
Did you mean: 

How to parse email body as a condition in MS flow



In my email body, I want to build a flow with a condition to look for email body with this string


<span style=\\"background:red\\">Fail</span>


So I tried but it does not work.  Can you please tell me what am I missing?

@or(contains(triggerBody()?['Body'], '<span style=\\"background:red\\">Fail</span>'), contains(triggerBody()?['Body'], '"background:red\\'))


Community Support
Community Support

Hi @scheu,


Please try to add an action Convert HTML to text before the Condition.

I have made the following test and it just works fine.

The condition is configured likes below:

@or(contains(body('Html_to_text'), '<span style=\\"background:red\\">Fail</span>'),contains(body('Html_to_text'),'background:red\\'))

Image for your reference.



Best regards,


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 @scheu

Not sure if you have considered using ? Its called Parserr in the connector list

Helps to do this without code and also extracts from PDF, CSV and Excel

Helpful resources

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.


Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Top Solution Authors
Users online (8,362)