Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
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!

  • Chriddle Profile Picture
    7,791 Super User 2025 Season 1 on at
    How to Extract a Specific Line Containing an Email Address from an Email Body
    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'),
    		' '
    	),
    	' '
    )
     
  • EI-06081227-0 Profile Picture
    8 on at
    How to Extract a Specific Line Containing an Email Address from an Email Body
    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? 
     
  • Suggested answer
    Michael E. Gernaey Profile Picture
    43,216 Super User 2025 Season 1 on at
    How to Extract a Specific Line Containing an Email Address from an Email Body
    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
     

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

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard >