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 / Forward emails to spec...
Power Automate
Unanswered

Forward emails to specific address based on subject line

(0) ShareShare
ReportReport
Posted on by

So far I haven't found anything similar enough to help me. 

 

What I'm trying:

 

I want automate to check the triggering emails subject line against the group name on the sharepoint list/excel sheet, and forward the entire email to the corresponding email address in the sharepoint list/excel sheet. The subject of the email will always be 4 digits and should match one of the 4 digit numbers in the list/sheet. 

 

Incoming Email Subject= ####                            (group name is 4 digit number)

 

Sharepoint list/Excel Sheet:

Group Name

Leaders Email

1111jdoe@email.com
1234pparker@email.com
2234mwatson@email.com
4444nstark@email.com

 

I'm struggling to find an expression using dynamic content that works. I'm a beginner to power automate, though I understand the basic foundations of how it works. 

 

Background:

 

I'm doing a survey for subgroups within my organization, and I want to automatically forward responses for each subgroup to the subgroup leader. The survey program from our website does not integrate directly with power automate, but it will send an email with the subgroup name as the subject line. I have a sharepoint list and excel sheet with each subgroup name and the leader for that groups email. The surveys are set to go to an outlook folder that will only be used for the surveys. 

I'm a basic user of power automate, I'm learning how to use expressions with dynamic content. 

Categories:
I have the same question (0)
  • DamoBird365 Profile Picture
    8,942 Microsoft Employee on at

    Hi @jsmn 

     

    Here is a simple way of achieving this from the flow.

     

    DamoBird365_0-1641412411530.png

     

    Create a compose with an object like so:

     

    {
    "1234":"damien@damobird365.com",
    "5678":"ideas@damobird365.com",
    "1357":"noreply@damobird365.com",
    "2468":"oneone@damobird365.com"
    }

     

    and use the following expression for the To:

     

    outputs('Compose')?[triggerOutputs()?['body/subject']]
     
    It will select the key / value from your array based on the subject.  If the subject isn't one of the 4 numbers in the array, it will return null and the action will fail.  
     

    Please consider accepting my answer as a solution if it helps to solve your problem.

    Cheers
    Damien

    Please take a look and subscribe to my YouTube Channel for more Power Platform ideas and concepts, or take a look at my website. Thanks

  • DTSH Profile Picture
    11 on at

    Hi @DamoBird365 

     

    Is there a way to amend the expression for the To field so it serches the subject line for the key/value instead of requiring it to be an exact match?

     

    Thank you 🙂

  • VictorIvanidze Profile Picture
    13,073 on at

    Hi @DTSH ,

    please rephrase - what do you want to change?

    Provide an example please.

  • DTSH Profile Picture
    11 on at

    Hi @VictorIvanidze 

    I am trying to forward emails where the key value (1234) is part of a larger string of text in the subject line, for example the subject line reads: John Smith, Application ID: 1234. This automation fails unless the subject line is only the key value (1234), and no further text.

    Thanks for your help!

  • VictorIvanidze Profile Picture
    13,073 on at

    Hi @DTSH,

     

    ah, now I see.

    Well then update the flow - add a loop that will take each item  in Compose object and check if the subject contains its value.

  • DTSH Profile Picture
    11 on at

    Hello again, I'm stuck. I have tried to do this using the Do until action loop but I'm not having any luck. Can anyone show me how I need to proceed?

  • VictorIvanidze Profile Picture
    13,073 on at

    Show your flow.

  • DTSH Profile Picture
    11 on at

    Thanks, I really have no idea what I'm doing. The first three steps are basically identical to the flow in the first reply. The flow only works when the subject matches the key value in the Compose action step exactly and fails if the subject line includes other words.

    Flow.JPG

  • DTSH Profile Picture
    11 on at

    Would really appreciate anyone's help on this flow, if anyone has any suggestions? Thanks.

  • VictorIvanidze Profile Picture
    13,073 on at

    Just try to reproduce the flow provided by @DamoBird365

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 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard