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 / Sending multiple pdf f...
Power Automate
Answered

Sending multiple pdf files in one mail

(0) ShareShare
ReportReport
Posted on by 206

Hi Everyone,

In a folder, i have more than 90 pdf files to send by outlook.

I am trying to send 10 pdf in each email but i don't know how do to that.

 

Any idea?

thanks

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

    MichaelAnnis_1-1659632372712.png

    MichaelAnnis_2-1659632399448.png

     

    This basically makes a separate attachment list for each email; best of luck!

     

    Folder.GetFiles Folder: $'''C:''' 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
    # should actually be set variable %Number% to %Files.Count%
    SET Number TO Files.Count
    # get the integer part, not rounded (ultimately we will need 1 more loop than this if the decimal amount is not 0
    Variables.TruncateNumber.GetIntegerPart Number: Number / 10 Result=> NumofEmailLoops
    # Get the remainder by getting the decimal place (only works when the divisor is 10)
    Variables.TruncateNumber.GetDecimalPart Number: Number / 10 Result=> FractionalLoop
    # We need the fractional number to be a whole number, so multiply by 10; this is the number of PDFs left over for the last run
    SET FinalPDFs TO FractionalLoop * 10
    # if the pdfs remaining for last run is anything but 0, add 1 to the amount of email runs
    IF FinalPDFs > 0 THEN
    SET NumofEmailLoops TO NumofEmailLoops + 1
    END
    # create a list to temporarily hold the attachements that we are going to add
    Variables.CreateNewList List=> Attachments
    # this is going to hold the index of %Files% at which attachments left off
    SET CurrentPDF TO 0
    SET PDFMax TO 10
    # Loop 1 to Number of Email Loops
    LOOP LoopIndex FROM 1 TO NumofEmailLoops STEP 1
    # create a list to temporarily hold the attachements that we are going to add
    IF LoopIndex = NumofEmailLoops THEN
    SET PDFMax TO FinalPDFs
    END
    LOOP AttachmentsLoop FROM 1 TO PDFMax STEP 1
    Variables.AddItemToList Item: Files[CurrentPDF] List: Attachments
    END
    # send email here with attachments
    Variables.ClearList List: Attachments
    END

  • XRQ57 Profile Picture
    206 on at

    Hi Michael,

    Awesome solution!

    Thank you.

     

    I have made a modification because it was always the same file in the email (10 times the same).

    I think we need to increase CurrentPDF by one in the loop which is the number of the file in the list.

     

    XRQ57_0-1659692023828.png

     

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    You are absolutely right. I meant to put that in there and forgot. Good catch. 

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 419

#2
Vish WR Profile Picture

Vish WR 314

#3
David_MA Profile Picture

David_MA 260 Super User 2026 Season 1

Last 30 days Overall leaderboard