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

MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Top Solution Authors
Users online (1,170)