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 / Need Help with Power A...
Power Automate
Unanswered

Need Help with Power Automate: Extracting Email Address & Sending Auto-Reply from Email Body

(0) ShareShare
ReportReport
Posted on by 2

Hi everyone,

I’m new to Power Automate and trying to create a flow to automate a task for our team. I’ve been using AI tools to guide me through the process, but I’ve hit a roadblock and could really use some help!

Why We’re Building This

Our organization receives lead inquiries through an online form that we don’t control. The form sends data via email to a shared mailbox, with the lead’s email address included in the body of the email. The From address is always the same.

Our goal is to use Power Automate to process these emails by:

  1. Extracting the email address from the body.
  2. Sending a default reply to each new lead.
  3. Adding rules to avoid auto-replying to replies (emails with "Re:") and ensure only unread emails are processed.

At a high level, the flow should:

  1. Check the shared mailbox for new emails.
  2. Confirm the email is not a reply (no "Re:" in the subject).
  3. Confirm the email is unread.
  4. Convert the email from HTML to text.
  5. Extract the email address from the body.
  6. Send a default reply from the shared mailbox.
  7. Mark the email as read.

Here’s What I’ve Done So Far:

  1. Trigger:

    • Used the "When a new email arrives in a shared mailbox (V2)" trigger.
  2. Condition (True/False):

    • Subject does not contain "Re:".
    • Is Read is equal to false.
  3. Converting HTML to Plain Text:

    • Used the HTML to Text action to convert the email body from HTML to text.
  4. Initialize Variable:

    • Name: ExtractedEmail
    • Type: String
  5. Set Variable:

    • Name: ExtractedEmail
    • Value: replace(replace(replace(split(split(outputs('HTML_to_Text'), 'Renter Email: ')[1], ' ')[0], '<', ''), '>', ''), ',', '')
  6. Debugging Step:

    • Added a Compose action:
      • Input: ExtractedEmail (to verify what is being pulled).
  7. Send an Email from a Shared Mailbox (V2):

    • Original Mailbox Address: The shared mailbox email.
    • To: ExtractedEmail.
  8. Mark as Read or Unread (V3):

    • Message Id: Message ID from the "When a new email arrives in a shared mailbox (V2)" trigger.
    • Original Mailbox Address: The shared mailbox email.

The Problem

No matter what I do to extract the email address from the body, the string

replace(replace(replace(split(split(outputs('HTML_to_Text'), 'Renter Email: ')[1], ' ')[0], '<', ''), '>', ''), ',', '')

is not being executed.

Instead of pulling the email address, the output is just the string itself. I can’t seem to get the expression to resolve and extract the email.

Categories:
I have the same question (0)
  • Anchov Profile Picture
    1,986 on at

    While extracting the email from the email body using traditional string parsing is certainly possible, have you considered leveraging Generative AI for this task? Using AI could simplify your flow, make it more robust, and potentially provide additional options, such as creating custom replies based on the email's content in the future.

    You can explore the pre-built prompt templates available in AI Builder, which make integration with Power Automate seamless. This approach can save time and effort while improving reliability. If cost is a concern, you could also explore building a custom AI model in Azure to achieve similar results.

    I recall seeing a video where someone demonstrated a similar solution during one of the Power Platform community calls. I’ll try to locate it and share it with you.

    Edit: here is the video (at the time of the presenter starts): Sean Astrakhan​ - How to build an auto-email responder using Power Automate and Azure AI Studio

  • TA-06121510-0 Profile Picture
    2 on at
    This looks interesting, but adding AI introduces additional costs, and I'm not sure I want to pursue that. All we're looking for is a simple solution to auto-reply to incoming messages with the same response.

    On a related note, does anyone know why extracting the email from the email body using traditional string parsing isn't working? I must be missing something obvious. It almost seems like the string isn't being treated as a string but rather as plain text.


     

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