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:
- Extracting the email address from the body.
- Sending a default reply to each new lead.
- 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:
- Check the shared mailbox for new emails.
- Confirm the email is not a reply (no "Re:" in the subject).
- Confirm the email is unread.
- Convert the email from HTML to text.
- Extract the email address from the body.
- Send a default reply from the shared mailbox.
- Mark the email as read.
Here’s What I’ve Done So Far:
-
Trigger:
- Used the "When a new email arrives in a shared mailbox (V2)" trigger.
-
Condition (True/False):
- Subject does not contain "Re:".
- Is Read is equal to
false.
-
Converting HTML to Plain Text:
- Used the HTML to Text action to convert the email body from HTML to text.
-
Initialize Variable:
- Name:
ExtractedEmail
- Type: String
-
Set Variable:
- Name:
ExtractedEmail
- Value: replace(replace(replace(split(split(outputs('HTML_to_Text'), 'Renter Email: ')[1], ' ')[0], '<', ''), '>', ''), ',', '')
-
Debugging Step:
- Added a Compose action:
- Input:
ExtractedEmail (to verify what is being pulled).
-
Send an Email from a Shared Mailbox (V2):
- Original Mailbox Address: The shared mailbox email.
- To:
ExtractedEmail.
-
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.