cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DrBone
New Member

Extract email address from body of an email

Hi everyone,

I'm looking on a product to automate our mail box around different departments, however we are running trough some issues. So what we trying to achieve:
1. Email arrive to your mailbox > flow reads an email and look for email address inside a body > forward email to that specific email address.


example of an email:


From: email@email.com
Subject: Thank you for your email.
Body:

Dear Person,
Thank you for your ... some text ... please forward this email to: example123@sometext.com.
Some text, and more text
Thank You.

I want flow to look inside this email and look for whatever email address is inside a body to forward and then forward whole thing to that specific email.
- Is that can be achieved ? If so could anyone give any directions where to go ?

Thank you for your time and help
1 ACCEPTED SOLUTION

Accepted Solutions

Hi @DrBone ,

 

Thanks for updating.

 

I am afraid that it might be difficult to achieve your goal using WDL functions simply.

 

However, there is a connector Parser, which could be used to extract data from emails & automate your workflow with our powerful email parser software.

 

Please check the following doc for more details:

https://docs.microsoft.com/en-us/connectors/mailparser/

 

Best regards,

Mabel

 

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.

View solution in original post

3 REPLIES 3
v-yamao-msft
Community Support
Community Support

Hi @DrBone ,

 

Do you want to extract an email address from the arrived email body?

 

You need to combine with functions such as indexof, substring, sub, add, etc.

 

I have made the following flow for your reference.

 

After the trigger When a new email arrives, add action Html to text to convert the email body to plain text.

 

Add Compose action with the following code:

add(indexOf(body('Html_to_text'),'please forward this email to:'),29)

Compose2 with the following code:

add(lastIndexOf(body('Html_to_text'),'.com.'),4)

 

Compose3 with the following code:

substring(body('Html_to_text'),outputs('Compose'),sub(outputs('Compose_2'),outputs('Compose')))

 

The above functions will finally return the required email address.

 

Images for your reference:

1.PNG2.PNG

 

Best regards,

Mabel          

 

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.
DrBone
New Member

Hi,
Thank you for your response.
It seems to work however there is few challenges with it.
Not all emails have ending by ".com" also if there is added signature with website address is registered it as well.
Ex of an email:
From: test123@example.com
Subject: some text

Hi, some text
Some more text
Please forward to: example@example.com
There is some more text
Regards
Name surname
123 street name
Country
Code
www.example.com

Output of it is:
"example@example.com
There is some more text
Regards
Name surname
123 street name
Country
Code
www.example.com"

Also some emails are
Could you forward this email to: emailAddress
I mean all emails are different and don't have specific string of "forward to:"

Solution for email ends .co.uk or .com and/or condition ?
Could use it however how it works with website address in signature ?

Thank you.

Hi @DrBone ,

 

Thanks for updating.

 

I am afraid that it might be difficult to achieve your goal using WDL functions simply.

 

However, there is a connector Parser, which could be used to extract data from emails & automate your workflow with our powerful email parser software.

 

Please check the following doc for more details:

https://docs.microsoft.com/en-us/connectors/mailparser/

 

Best regards,

Mabel

 

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.

View solution in original post

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

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.

Users online (1,087)