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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Automate
Unanswered

Parse email content

(0) ShareShare
ReportReport
Posted on by 14

Hi,

 

I've been reading various guides, but i'm unable to extract an email address from the body of an email. The email comes in the same format each time - example below

 

<p>This email has been automatically generated by the contact message system as your preferences are set to receive an email copy. Please sign in to the system to see your message sent by:

Sent By: Chris Brown
Email Address: my.email@email.co.uk


This communication contains information which is confidential, which may be privileged, and which is for the exclusive use of the intended recipient(s).
</p>

 

I'm trying to extract the text after 'Email Address: ' but don't seem to be able to.

 

Any ideas?

Thanks 

Categories:
I have the same question (0)
  • Expiscornovus Profile Picture
    33,851 Most Valuable Professional on at

    Hi @brownoNCYFL,

     

    If it is always the same format you can use a couple of split functions in an expression to extract that e-mail address.

     

    Below is an example of such an expression:

     

    split(split(outputs('Compose'), 'Email Address: ')[1], 'This communication contains information which is confidential')[0]

     

    expression_extractemail.png

  • brownoNCYFL Profile Picture
    14 on at

    Hi @Expiscornovus

     

    Have just tried that on a Compose, but i'm getting the following error...

    Unable to process template language expressions in action 'Compose_3' inputs at line '1' and column '23179': 'The template language function 'split' expects its first parameter to be of type string. The provided value is of type 'Object'. Please see https://aka.ms/logicexpressions#split for usage details.'.

  • Expiscornovus Profile Picture
    33,851 Most Valuable Professional on at

    Hi @brownoNCYFL,

     

    What actions are you using in your setup, can you share a screenshot?

     

    The code snippet I shared was just an example, it definitely needs to be changed before it works in your setup. 

  • brownoNCYFL Profile Picture
    14 on at

    Sure, here's the setup...

     

    Thanks,image.png

  • Expiscornovus Profile Picture
    33,851 Most Valuable Professional on at

    Hi @brownoNCYFL,

     

    You could use the outputs of the HTML to text action.

     

    The expression would be:

     

    split(split(outputs('Html_to_text')?['body'], 'Email Address: ')[1], 'This communication contains information which is confidential')[0]

     

     

  • brownoNCYFL Profile Picture
    14 on at

    Thanks for your help again, I'm still getting an error though...

    image.png

  • Expiscornovus Profile Picture
    33,851 Most Valuable Professional on at

    Hi @brownoNCYFL,

     

    First of all I made a small typo in my previous post. I changed this in the expression from outputs('Html_to_text') to outputs('Html_to_text')?['body']

     

    Secondly, can you expand that html to text action from your last flow run and check if the plain text content field contains the data you are expecting?

     

    plaintextcorrect.png

  • brownoNCYFL Profile Picture
    14 on at

    Thanks again @Expiscornovus, I've tweaked it and attached the error below. 
    Also added the html to text output

     

    image.pngimage.png

  • Expiscornovus Profile Picture
    33,851 Most Valuable Professional on at

    Hi @brownoNCYFL,

     

    I think we are getting closer to the solution 😁

     

    It looks like the first split function can't find 'Email Address: ' string. Maybe we need to try to only use 'Address: '.

     

    Can you try this new expression:

    split(split(outputs('Html_to_text')?['body'], 'Address: ')[1], 'This communication contains information which is confidential')[0]

     

  • brownoNCYFL Profile Picture
    14 on at

    Thanks again @Expiscornovus.

    That's worked sort of! It's got the email address at the start, but kept the footer there... How can we strip out the text after the email address to be just left with the email address?

    image.png

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 785

#2
Valantis Profile Picture

Valantis 669

#3
Haque Profile Picture

Haque 563

Last 30 days Overall leaderboard