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 / Send Email To Differen...
Power Automate
Unanswered

Send Email To Different People Based On File Name Using Flow

(1) ShareShare
ReportReport
Posted on by 21

Hello,

 

I want to build a flow sending email attachments automatically to different people based on file name.

* The pdf files are in Onedrive folder ( might be moved to a sharepoint folder if necessary for building the flow)

* I save pdf files to a specific folder with a particular format;

"SupplierName_YYYYMM_EmplyeeShortName_InvoiceNo"

For examle:

Hilton_202407_CKent_123456

ItalianRestaturant_202407_CKent_789456

ThePlaza_202407_LLane_852963

TheRitz_202407_LLuthor_741852

 

I have a sharepoint list for the employee short names and corresponding emails

Emtu_1-1720439508707.png

 

So I want to build a flow which will send the pdf files (invoices) as attachment in an email to respective employee when a new file saved with her/his short name in the folder of employee travel expenses. 

For instance; 

Hilton_202407_CKent_123456 : will be sent to Clark Kent

ItalianRestaturant_202407_CKent_789456: will be sent to Clark Kent

ThePlaza_202407_LLane_852963: will be sent to Lois Lane

TheRitz_202407_LLuthor_741852: will be sent to Lex Luthor

Hope someone can help!

 

Thanks in advance!

Categories:
I have the same question (1)
  • Verified answer
    Tristan_D Profile Picture
    400 on at

    Hi @Emtu !

    You can do it by using the following flow and replacing the trigger by the onedrive connector and by using in the variable varFileName the attachment name :

    Tristan_D_0-1720445309319.png

    Tristan_D_1-1720445329128.png


    the contains can be removed, I just use it to check the condition manually : 

     

    contains(variables('varFileName'),items('Apply_to_each')?['Title'])

     

     

    Tristan_D_2-1720445421701.png

     

     

    Tristan_D_3-1720445446211.png


    That should do the trick 😉.

    I let you try that and let me know if it helps.

    T

  • Emtu Profile Picture
    21 on at

    Actuallu no, it sent same email to everyone in the list.

  • Tristan_D Profile Picture
    400 on at

    ok so it means that you have an issue with your filter or contains.

    Can you send me your flow's screenshots please ?

    T

  • Emtu Profile Picture
    21 on at

    I had skipped the "Compose" at first but now added and it works thank you!

  • Tristan_D Profile Picture
    400 on at

    That can happen 😉

    Thanks for the feedback !

    T

  • TM-08111125-0 Profile Picture
    2 on at
    I am in a similar situation and would really like to try this solution, but I cannot open/see the images to be able to follow the solution.
     
    Are you able to reupload them or share them as a link?
     
    Thank you :-)

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

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard