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 / how to send multiple a...
Power Automate
Unanswered

how to send multiple attachments in one email

(0) ShareShare
ReportReport
Posted on by 6

Hello all,

 

Using Power Automate Desktop, I am trying to loop through all files in a folder and attach all files found and send an email having all attachments.

I have tried many workarounds, but I haven't had much luck

  • creating a list
  • then getting all files from folder
  • for all files in files
    • add item to list

When I am at the last step, send an email (V2), I have to use Office 365 Outlook option), for the attachments i put the list and then I keep getting the error below

gboto1983_0-1716216560329.png

 

 

Any ideas?

 

Thank you in advance

I have the same question (0)
  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    Would you be open to using the Send Email through Outlook functionality rather than the Send Email V2 functionality?  It works from an Attachments = %Attachments% (list of filepaths you want to attach) point of view.  

    The Send Email V2 is more API based and I'm getting errors like I don't have To/Subject/Body filled out, when I clearly do, so I'm not sure what is going on with this feature.

  • Deenuji_Loganathan_ Profile Picture
    6,255 Moderator on at

    @gboto1983 

     

    I appreciate you introducing a completely new topic, which helped me learn some new things today. After struggling for two hours, I finally managed to get it to work.

     

    Here are the steps you need to follow:

    1. Create a new list to store all the attachments.

    2. Utilize the "get files in folder" function and apply the necessary filters.

    3. Iterate through the list of files using a loop.

    4. Create a variable called "AttachmentList" and initialize it with an empty value.

    5. Convert all the files into binary format since Office365 requires email attachments to be in bytes data format.

    6. Then, add the filename and binary data into a custom object.

    7. Add the custom object into the list.

    8. Once the loop is complete, assign the list to the attachment parameter.

     

     

    Deenuji_0-1716222712844.png

    Deenuji_0-1716223211725.png

     

    Code:

     

     

    Variables.CreateNewList List=> ListFileName
    Folder.GetFiles Folder: $'''C:\\Boot\\txt''' FileFilter: $'''*txt''' IncludeSubfolders: False FailOnAccessDenied: True SortBy1: Folder.SortBy.NoSort SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Files=> Files
    LOOP FOREACH CurrentItem IN Files
     SET AttachmentList TO $'''%''%'''
     File.ConvertToBinary File: CurrentItem.FullName BinaryData=> BinaryData
     SET AttachmentList TO { 'Name': CurrentItem.Name, 'ContentBytes': BinaryData }
     Variables.AddItemToList Item: AttachmentList List: ListFileName
    END
    @@'emailMessage/Sensitivity': ''
    @@connectionDisplayName: 'Office 365 Outlook PADDemo-16763'
    External.InvokeCloudConnector Connection: 'd6a85e0c-93e8-42a2-8c1d-076c8fb6c19f' ConnectorId: '/providers/Microsoft.PowerApps/apis/shared_office365' OperationId: 'SendEmailV2' @'emailMessage/To': $'''deenu@gmail.com''' @'emailMessage/Subject': $'''Multiple attachments''' @'emailMessage/Body': $'''PFA documents for your reference.
    
    Thanks,
    Deenu''' @'emailMessage/From': $'''deenu@microsoft.com''' @'emailMessage/Attachments': ListFileName

     

     


    Thanks,
    Deenuji Loganathan 👩‍💻
    Automation Evangelist 🤖
    Follow me on LinkedIn 👥

    -------------------------------------------------------------------------------------------------------------
    If I've helped solve your query, kindly mark my response as the solution ✔ and give it a thumbs up!👍 Your feedback supports future seekers 🚀

  • VishnuReddy1997 Profile Picture
    2,666 Super User 2026 Season 1 on at

    Hi @gboto1983 ,

     

    Please find the solution.

     

    VishnuReddy1997_2-1716223146938.png

     

    You can configure multiple attachements as shown in below.

    VishnuReddy1997_0-1716223054765.pngVishnuReddy1997_1-1716223095187.png

     

    Code:

    Please copy the below code to you flow.

    Folder.GetFiles Folder: $'''C:\\Users\\OneDrive\\Desktop\\Power Automate Desktop\\Practice\\Excel\\Excel Input''' FileFilter: $'''*''' IncludeSubfolders: False FailOnAccessDenied: True SortBy1: Folder.SortBy.NoSort SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Files=> Files
    Outlook.Launch Instance=> OutlookInstance
    Outlook.SendEmailThroughOutlook.SendEmail Instance: OutlookInstance Account: $'''varikutivishnuvardhan@ent.com''' SendTo: $'''varikutivishnuvardhan@acme.com''' Subject: $'''Sample Test''' Body: $'''Hi,
    
    PFA
    
    Regards,
    BOT''' IsBodyHtml: False IsDraft: False Attachments: $'''\"%Files[0].FullName%\" \"%Files[1].FullName%\"'''

     

    (Note:- if you got your solution you can mark as solution and gives kudos)


    Thanks & Regards

    Vishnu Reddy

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    This was a hard one...converting to binary is a crazy step, but it's passing the documents over APIs when using this premium connector, so it must need them in bytes.  Lots of extra steps.  Would prefer the Sned email message through Outlook if you can use it.

  • Deenuji_Loganathan_ Profile Picture
    6,255 Moderator on at

    @MichaelAnnis 

     

    I concur that it's slightly more intricate compared to Outlook actions, but I assumed the user has a specific reason for opting for the "send email(v2)" action. That's why I didn't talk about other options. However, it's true that @gboto1983 Outlook is extremely user-friendly and doesn't necessitate a premium license.

     

    If the user chooses to stick with the "send email(v2)" action, they'll need to adhere to my outlined steps exclusively, without any other shortcuts. Personally, I find it a valuable learning experience to delve into cloud-based connectors through PAD.

     


    Thanks,
    Deenuji Loganathan 👩‍💻
    Automation Evangelist 🤖
    Follow me on LinkedIn 👥

    -------------------------------------------------------------------------------------------------------------
    If I've helped solve your query, kindly mark my response as the solution ✔ and give it a thumbs up!👍 Your feedback supports future seekers 🚀

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    Agreed, I learned a lot in the same 2 hours...you beat me to it. 😂.  I was on a python path to convert the file data, nice to know it's built in.

  • Deenuji_Loganathan_ Profile Picture
    6,255 Moderator on at

    @MichaelAnnis 

     

    Lately, I've been diving into cloud-related packages solely through forum inquiries. It's thoroughly engaging. On the flip side, it appears that cloud connectors aren't always stable, as I encounter "bad gateway" requests at various stages. This can be frustrating at times, yet strangely rewarding when I'm brainstorming workarounds.

     


    Thanks,
    Deenuji Loganathan 👩‍💻
    Automation Evangelist 🤖
    Follow me on LinkedIn 👥

    -------------------------------------------------------------------------------------------------------------
    If I've helped solve your query, kindly mark my response as the solution ✔ and give it a thumbs up!👍 Your feedback supports future seekers 🚀

  • gboto1983 Profile Picture
    6 on at

    Hi @Deenuji ,

     

    thank you for your help.

    I have done all steps, I actually deleted all steps and did them one by one, as shown and same error

    gboto1983_0-1716229979188.png

    have you run it without errors?

     

    thank you

  • gboto1983 Profile Picture
    6 on at

    Hi @Deenuji ,

     

    the reason I ended up using Send email (V2) option is that, at least with my own Outlook, it is not opening the program, as I am on the new version of Outlook and it never opened no matter how many times i tried, so i am "stuck" with the V2

     

    checking on Microsoft's pages this is correct

    gboto1983_1-1716230866954.png

     

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    I'm getting the same error as well.  When I convert to BinaryData, the result is just [Byte 2] for every file.  Still looking.

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
Vish WR Profile Picture

Vish WR 376

#2
Valantis Profile Picture

Valantis 361

#3
David_MA Profile Picture

David_MA 294 Super User 2026 Season 1

Last 30 days Overall leaderboard