web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to Extract a Speci...
Power Automate
Suggested Answer

How to Extract a Specific Line Containing an Email Address from an Email Body

(1) ShareShare
ReportReport
Posted on by 8

Hello,

I'm working on a flow in Power Automate to extract a specific line from the body of an email.

The goal is to retrieve an email address that appears after a specific keyword in the email body. For example, my output text from a substring action (outputs('Substring')?['body']) looks like this:

I want to extract only the email address "Dein.Doe@Aimsts.com" from this text. However, the format is not consistent and can sometimes be:

Is there a way to reliably extract only the email address regardless of these variations?

Thank you!

Categories:
I have the same question (0)
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,369 Super User 2025 Season 2 on at
    Hi, 
     
    Will the email domain always be the same as in your example?
     
    There are going to be loads of ways of how to do this, but if its the same then you could
     
    Here are the steps and total code
     
    1. Split by :
    Split(HTMLText, ':')
     
     
    2. Split(Split(HTMLText, ':'), '@Aimsts.com)')
     
    3. You want the first part of step 2 
     
    So you want to concat the
    4. concat(trim(split(split(HTMLText, ':'), '@Aimsts.com)')[0]), '@Aimsts.com')
     
    But the above splits it at the :, then splits it again by the Domain, gets the array index 0 and trims any spaces, then puts the EmailDomain back. since it was part of the larger [1] index of the split
     
    If you have to use other email address's then we can do it another way, you can also use regular expressions
     
  • EI-06081227-0 Profile Picture
    8 on at
    HI @FLMike, thank for your answer 
     
    yes the domain will always be the same but is it also can be retrieved if the the format only like this ?
     
    200
     
     
    www.Aimsts-pharma.com? 
     
    And is it possible to retrieved the email with different domain? 
     
  • Chriddle Profile Picture
    8,441 Super User 2025 Season 2 on at
    Since the "specific keyword" is not specific, it might be a good idea to check just for email addresses
    (OK, contains an "@" is not a thorough check, but you can easily extend this by looking for other characteristics if necessary):
     
    split(
    	replace(
    		outputs('Compose'),
    		decodeUriComponent('%0A'),
    		' '
    	),
    	' '
    )
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard