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 with Multip...
Power Automate
Unanswered

Send Email with Multiple Attachments

(0) ShareShare
ReportReport
Posted on by

I built a flow that would get attachments from SharePoint and append to an Array to use to send multiple attachments.

I followed the set of instructions using this link https://flow.microsoft.com/en-us/blog/multiple-attachments-single-email/.

Now the flow is working, however, instead of sending one email, it seems to be sending an email per attachment, so if I have 3 attachments it will send 3 emails, and sometimes attaching the same documents 2 or 3 times in the same email.

Could you please tell me what I'm doing wrong?

 

Thank you!

 

 

11223344556677

Categories:
I have the same question (0)
  • efialttes Profile Picture
    14,756 on at
    Hi!
    The problem is, 'Send an email' is currently inside several nested Apply to each. You need to find the way to move it outside all of them in order to get a single email sent.
    Hope this helps
  • Community Power Platform Member Profile Picture
    on at

    @efialttes Thank you!

    Do you know how this could be done when you have so many dependencies?

    The only thing I can think of is create a separate flow for the email portion. Is there any better way to do that?

  • v-litu-msft Profile Picture
    on at

    Hi @Anonymous,

     

    @efialttes is correct, you should put the send Email out of the Get attachments loop. After all attachments appended, send the Email.

    In case of same attachment will be sent multiple times, after a loop to Append to Array variable and Send Email, you should empty the array variable by using Set variable action to set it to Null:

    Annotation 2020-04-10 163619.png

     

    Best Regards,
    Community Support Team _ Lin Tu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • efialttes Profile Picture
    14,756 on at

    @Anonymous 

    You are handling at least 4 nested 'Apply to each' in the same flow, right? If so, if I were you I would review the current design to check if you can remove innecesary 'Apply to each'

     

    For example, on the screenshots you shared I've seen 'Get items' outputs assigned as input to an 'Apply to each' that when executed  iterates over a single item. IF you implemented such aproach to always get a single item from your Sharepoint list, then:

    -either you can replace these two action blocks and use 'Get item' instead, or

    -you can use first() or last() expression to handle the single result from 'Get items' outputs, meaning you do not need the 'Apply to each' anymore

     

    I cannot recommend any other specific simplification approach to your current flow, since the screenshots shared are fragmented so it's hard to understand the overall goal you want to achive with flow implementation

    Ánimo!

  • Community Power Platform Member Profile Picture
    on at

    @efialttesand @v-litu-msft  Thank you for your suggestions! 

    I'm still kind of new to flow design, but the 1st Apply to each is to save attachments from Forms to SharePoint using this model: 

    https://www.youtube.com/watch?v=IDW3ikTHu9U

     

    2nd Apply to each I used was to be able to calculate a difference between 2 dates, following that model: https://powerusers.microsoft.com/t5/Building-Flows/Flow-to-calculate-elapsed-days-since-List-item-modified/td-p/182614

     

    And the 3rd Apply to each (here Apply to each 4) is to add multiple attachments to an email using the following model:

    https://flow.microsoft.com/en-us/blog/multiple-attachments-single-email/

     

    If there's a better way to combine all three in your opinion, please let me know!

     

    Thanks again!

     

  • efialttes Profile Picture
    14,756 on at
    Hi!
    "And the 3rd Apply to each (here Apply to each 4) is to add multiple attachments to an email"
    So... do you really need this Apply to Each nested, i.e. inside other 'Apply to Each'?
    Hope this helps
  • Community Power Platform Member Profile Picture
    on at

    @efialttes Actually the "Send an email" item is outside of "Apply to each 4" as can be seen below.

    It is just so it collects all the attachments and stores it in the array. Do you think I should remove it nevertheless? I don't think it should affect the number of emails sent though, would it?

     

     

    Flow8.PNG

     

    Thank you!

  • Community Power Platform Member Profile Picture
    on at

    @efialttes @v-litu-msft  I am not sure the problem is "Apply to each"; it seems related to the number of attachments that are being loaded in SharePoint. Could it be a time lag and loading time issue? I just re-tested it, so if I attach only 1 file, I get 1 e-mail which is fine. If I attach 2 files, I get the 1st e-mail with 1 attachment, and a second e-mail with 2 attachments. Now if I attach 3 files, I get 1 e-mail with 1 attachment, the second with 2 attachments, and the third with 3 attachments. In addition I get the emails in the same order of the loaded attachments; i.e. the first attachment loaded is coming first, then the first and second, then first second and third, etc.

     

    Do you still think it's an  "Apply to each" issue?

     

    Thanks!

  • Verified answer
    efialttes Profile Picture
    14,756 on at

    Hi!

     

     

    the 1st Apply to each is to save attachments from Forms to SharePoint using this model: 

    https://www.youtube.com/watch?v=IDW3ikTHu9U

     

    So, if the 'Send an email' is inside this 1st 'Apply to each' and you have 2 attachments, 1st Apply to Each will iterate 2 times, and you will send two emails instead of one

     

    2nd Apply to each I used was to be able to calculate a difference between 2 dates, following that model: https://powerusers.microsoft.com/t5/Building-Flows/Flow-to-calculate-elapsed-days-since-List-item-modified/td-p/182614

     


    Now, you have a 2nd Apply to Each inside the first Apply to Each. If 'Send an email' is inside this 2nd 'Apply to each' also, an assuming 2 attachments, you will not send 2 emails, but 2 multiplied by N emails, being N the number of iterations of 2nd 'Apply to each'

     

    If your goal is to send a single email, move 'Send an email' outside all these nested 'Apply to each'

    Hope this helps

     

     

  • Community Power Platform Member Profile Picture
    on at

    Thank you @efialttes and @v-litu-msft!

     

    I was able to make it work thanks to your suggestions. I had to add a few steps, but was at least able to get the Send e-mail out of all the "Apply to each" as per below:

     

     

    WorkingFlow1.PNG

     

     

     

    WorkingFlow2.PNG

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

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard