Send Email Attachments with Power Automate - Simplify Your Process

Send Email Attachments with Power Automate: Simplify Your Process

No comments

Loading

In this article, we will learn about how to send email attachments with Power Automate from SharePoint document libraries or list attachments. This will definitely simplify your email sending with multiple attachments from SharePoint using Power Automate flow.

Business use case: Why should we send email with attachments automatically with Power Automate?

There are many use cases if you manage your content in SharePoint, for example, whenever users add any attachment to the list item you want those attachment files should be sent to the concerned department for their review. Second use case we can think like, you are maintaining company’s corporate policy documents in the document library, this is common for all new employees. In this case, what we can do is whenever new employee gets added to the employee onboarding list, we can send those policy related documents to the newly onboarded employee. To automate this email sending process, we can develop a Automated cloud flow. Learn about the various types of flows that can be created in Power Automate.

Sending email attachments with Power Automate will simplify your email process, and sending emails with attachments automatically using Power Automate can help businesses save time, reduce errors, ensure consistency, and improve productivity.

By automating this process, businesses can focus on more important tasks, such as growing their business and serving their customers.

Send Email Attachments with Power Automate: Simplify Your Process

By now we understand the business need of sending email automatically with Power Automate; now we will get into the Power Automate development flow automatically.

Here is the complete flow, it is very simple and self explanatory, however, we will explain the each actions.

Send Email Attachments with Power Automate flow
Send Email Attachments with Power Automate flow

When the above flow is completed successfully, we can see that an email has been delivered to the Global SharePoint user, as shown below:

Send email with multiple attachments with Power Automate flow demo
Send email with multiple attachments with Power Automate flow demo

Flow Explanation: Send Email Attachments with Power Automate

Before getting into the flow explanation, here are my files in the SharePoint document library and project list to trigger the flow.

Files in SharePoint Online document library
Files in SharePoint Online document library
SharePoint Online list to trigger the Power Automate flow
SharePoint Online list to trigger the Power Automate flow

We will use the above document library and list in this send email attachments with Power Automate demo, where we will trigger the flow when an item is added or modified in the project list and then read all files from the documents folder 1 and send them as email attachments.

Step 1: Add a trigger action

The first action in the flow is trigger action, when an item is created or modified in SharePoint list.

When an item is created or modified
When an item is created or modified

Step 2: Initialize array collection variable

Add an array type collection variable to hold the attachments.

Initialize array collection variable
Initialize array collection variable

Step 3: Get files from the document library

Add a Get files (properties only) action to read all files from the SharePoint document library, where your files are stored. In this case, my files are in the default “Documents” library inside “Folder 1.”

Get files from the document library
Get files from the document library

Note:

  • In the above demo, we have read the files from a document library folder, and we can even read files from the SharePoint list attachments using the Power Automate get attachments action.

Step 3: Loop through each documents in the path

Add an “Apply to each” control. And, add the value from the previous step “Get files (properties only)”.

Apply to each control to loop through each SharePoint files
Apply to each control to loop through each SharePoint files

Inside the loop, add a “Get file content” action.

Pass your site URL and select the file identifier from the “Get files (properties only)” action.

Get file content in Power Automate
Get file content in Power Automate

Then, add an action “Append to array variable”.

The format of the value is:


{

"Name": "Select the file name with extension from the get files (properties only) action",

"ContentBytes": "Select file content from the get file content action"

}

 

 

Append to array variable in Power Automate
Append to array variable in Power Automate

 

Step 4: Send email with attachments

Outside the apply to each control loop, add a “Send an email (V2)” action. Understand the difference between “Send an email (V2)” and “Send an email (V3).”

Send email with multiple attachments with Power Automate flow configuration
Send email with multiple attachments with Power Automate flow configuration

In the email, pass the following parameters as per your needs:

  • To: This is required.
  • Subject: This is required.
  • Body: This is required.
  • From (Send as): This is optional; however, it is very important to pass. Generally, if we keep this field empty, an email will be sent from the “Send an email (V2)” connection email. Then, if you want your email to be sent with a custom email ID, we should pass the custom email ID.
  • Attachments: Optional, but of course this is required in this demo as we are learning the email attachment functionality from Power Automate.

In the attachments section, you need to click on the “Switch to input entire array” icon button.

Then, pass the array collection variable as shown below:

Switch to input entire array - Send email with multiple attachments with Power Automate flow
Switch to input entire array – Send email with multiple attachments with Power Automate flow

If you don’t click on the “Switch to input entire array” icon, what will happen?

Let’s see this practically, the opposite option is “Switch details input from array item”.

Once we change the switch to “Switch details input from array item”. We can not see the array variable in the dynamic content selection. And if we try to pass the attachment variable manually, we will get the below error:

Adjust the attachment to include content for action ‘send_an_email_(v2)’

“Flow save failed with code ‘OpenApiOperationParameterValidationFailed’ and message ‘Input parameter ’emailMessage’ validation failed in workflow operation ‘Send_an_email_(V2)’: The API operation ‘SendEmailV2′ is missing required property ’emailMessage/Attachments/0/ContentBytes’.’.

adjust the attachment to include content for action ‘send_an_email_(v2)'”

Flow checker - adjust the attachment to include content for action 'send_an_email_(v2)
Flow checker – adjust the attachment to include content for action ‘send_an_email_(v2)

Summary: Send Email Attachments with Power Automate to Simplify Yur Process

Thus, in this article, we have learned the following with respect to sending email attachments with Power Automate:

  • How to Send Multiple Email Attachments Using Power Automate Cloud Flow
  • How to read files from a SharePoint document library and send those as email attachments using Power Automate.
  • How to send the email as a personalised email.
  • How to fix the issue “adjust the attachment to include content for action ‘send_an_email_(v2)'”.

See Also: Power Automate Tutorials

You may also like the below Power Automate tutorials:

If you would like to appreciate our efforts, please like our post and share it with your colleagues and friends. You may join the email list; it won’t spam you; it’s just notifications of new posts coming in, nothing else. 🙂

Loading

Happy automating and learning!

About Post Author

Do you have a better solution or question on this topic? Please leave a comment