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 Platform Community / Forums / Power Automate / Forwarding emails to d...
Power Automate
Answered

Forwarding emails to different addresses based on the subject

(0) ShareShare
ReportReport
Posted on by 4
hi, I've been trying to use power automate to forward emails (together with the attachment) based on the subject line. what I need it to do is every time I get an email with the subject "abc1" it should be forwarded to the email address "xyz1@com", email with the subject "abc2" should be forwarded to "xyz2@com", "abc3" to "xyz3@com" etc. it would be great if it was easy to adjust (so the emails/subject would be stored somewhere)

the issue is that I have almost 30 different email addresses so the way I'm currently doing it with a switch case for each address is not going to work. I also can't actually forward the emails (my company doesn't allow it) so I create a new email and add the attachment to it (this breaks some flows).
I have the same question (0)
  • Verified answer
    David_MA Profile Picture
    14,815 Super User 2026 Season 1 on at
    What if you create a SharePoint list with all of the subject lines. Make sure it is required and that the field value must be unique so there cannot be duplicate subject lines. Then add a text field with the forward to e-mail address and any other details needed to process them.
     
    You can add a trigger condition so it only triggers when the subject equals one of the 30 subject lines. For example:
     
    @or(
      equals(triggerOutputs()?['body/subject'], 'abc1'),
      equals(triggerOutputs()?['body/subject'], 'abc2'),
      equals(triggerOutputs()?['body/subject'], 'abc3')
    )
     
    Keep adding to this for each of the 30 subject lines. Just keep in mind, this requires an exact match for the flow to trigger including case. If you want the flow to trigger on either abc1 or ABC1, you should write the trigger condition like this:
     
     
    @or(
    equals(toLower(triggerOutputs()?['body/subject']), 'abc1'),
    equals(toLower(triggerOutputs()?['body/subject']), 'abc2'),
    equals(toLower(triggerOutputs()?['body/subject']), 'abc3')
    )
     
    When the flow triggers, use a get items action with a query filter to get the SharePoint list item that matches the subject line: Title eq '@{toLower(triggerOutputs()?['body/subject'])}'. You can use information from the matching item to get the e-mail address to forward the e-mail.
     
    When you do this, it will put it into an apply to each, but since the e-mail subjects are unique and your filter query will use eq in the expression, it should either return 1 or 0 items. You can use a condition with a length() expression to make sure 1 item is returned. Then you can put the apply to each on the yes side of the condition and let the no side handle error processing.
     
    This will not solve your problem of not being able to forward the e-mails. But why can't you just create a new e-mail, address it to the recipient, and populate the new e-mail with information from the received e-mail?
  • Suggested answer
    11manish Profile Picture
    2,837 on at
    For your scenario, I would avoid using a Switch action with 30+ cases. While it works initially, it becomes difficult to maintain whenever a subject line or destination
     
    email changes.
     
    Store the Routing Rules in a Data Source
     
    Create a simple configuration table in:
    • SharePoint List (recommended)
    • Excel Table
    • Dataverse Table
    For maintainability and scalability, I recommend:
     
    Outlook Email -> Power Automate -> SharePoint Routing List-> Lookup Destination ->Create New Email -> Copy Attachments -> Send
     
    This approach eliminates the need for dozens of Switch cases, makes future changes simple, and provides a centralized location for managing subject-to-recipient
     
    mappings. It also works well when handling attachments and complies with environments where native email forwarding is restricted.
  • werka Profile Picture
    4 on at
     
    thank you, this worked :) turns out I wasn't using query filters correctly.
     
    for some reason it put the "send email" action into two "apply to each", perhaps it was why I couldn't create an email before? because it was only in one? or it could be another incorrect query filter really. 
  • David_MA Profile Picture
    14,815 Super User 2026 Season 1 on at
    @werka you will need to post an image of the workflow you ended up with and how it is configured for me to determine why two apply to each action were used, but it is potentially possible depending on what you've done.

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 410

#2
Vish WR Profile Picture

Vish WR 289

#3
David_MA Profile Picture

David_MA 282 Super User 2026 Season 1

Last 30 days Overall leaderboard