cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Yacob_hard
Advocate I
Advocate I

Parse an email for content in the body

Hi there,

 

I'm trying to build a flow where the following happens;

1. Contact Us email is received

2. Flow picks the email address out of the of the body of the received email

3. Flow delivers an email to the email address provided

 

I'm struggling to find an adaptable solution to #2.

 

Here's the format of an email i'd want the flow to read;

 

 First name: *****

 Last name: *****

 E-mail: ******@live.co.uk

 May we contact you about news and offers: yes

 Message: How can I do x while y?

 

The "First name", "Last name", and "E-mail" output are all of variable lengths (determined by the users who input) and so existing solutions i've found on the forums don't seem to help (as far as i can understand);

 

https://powerusers.microsoft.com/t5/Building-Flows/Read-email-content-from-body-of-the-email-extract...

https://powerusers.microsoft.com/t5/General-Flow-Discussion/Using-a-flow-to-extract-email-body-detai...

 

Any suggestions would be welcome! 🙂

1 ACCEPTED SOLUTION

Accepted Solutions
yashag2255
Dual Super User II
Dual Super User II

Hi @Yacob_hard , 

 

Please refer to the screenshots below and replicate the steps. 

ema1.png

The initialise variable 2 has the value set as an empty line. You can do that by clicking on the value and pressing enter. ema2.png

In the compose action, use this expression 

split(Variables('ww'), variables('test'))

Replace the variable names with the ones you create.

In the set variable value, use the expression:

split(items('Apply_to_each'),':')[1]

This will fetch you the email address. 

 

Important Note: This will work as long as there is no mention of 'E-mail' before the actual E-mail: xyz@acd.com. 

 

Hope this helps. 

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

5 REPLIES 5
yashag2255
Dual Super User II
Dual Super User II

Hi @Yacob_hard , 

 

Please refer to the screenshots below and replicate the steps. 

ema1.png

The initialise variable 2 has the value set as an empty line. You can do that by clicking on the value and pressing enter. ema2.png

In the compose action, use this expression 

split(Variables('ww'), variables('test'))

Replace the variable names with the ones you create.

In the set variable value, use the expression:

split(items('Apply_to_each'),':')[1]

This will fetch you the email address. 

 

Important Note: This will work as long as there is no mention of 'E-mail' before the actual E-mail: xyz@acd.com. 

 

Hope this helps. 

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Thanks @yashag2255 , that's worked perfectly.

 

My first time working with variables in flow 🙂 

Awesome! Glad that it worked.

 

Thanks,

Hi @yashag2255,

 

Thanks again for providing the solution.

 

I'm struggling to understand how this works, in particular;

 

1. Why does variable 2 need to be set as blank with 2 lines?

2. How does the compose action pull out an appropriate value?

Hey!

 

1. The variable has the value (/n/n this is basically a new line)

In the email we have the First Name in first line and Second in Second and Email in third etc. So we split the email body on that new line component and get the desired email value by the other filter. 

2. Refer to the formula used in compose: It gives the array as we required and mapped in the pt. 1. 

 

Hope this helps.

Helpful resources

Announcements
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.

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.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Users online (3,322)