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

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:
  • Verified answer
    Tristan_D Profile Picture
    405 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
    405 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
    405 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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 231 Super User 2026 Season 2

#2
David_MA Profile Picture

David_MA 217 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 170

Last 30 days Overall leaderboard