cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Adam_F
Frequent Visitor

Power app - Sending email via power automate with multiple attachments

I've created a button on a power app that i want to trigger a power automate flow that sends an email. I have this working for the email to, email subject and email body. But if i want to send multiple attachments on the same email, i don't know how to reference the collection with the data in it and also for multiple email attachments.

 

I looked at various links online to get me where i wanted but it always mentions SharePoint instead. In my scenario, it is saving the attachments in the Power apps blob store in a collection. 

 

I used the following link to create my attachments box: - 

 

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

 

The method used in the video sends the email successfully, however i want to utilise Power automate so i can reuse the flow rather than duplicating the same code over and over for different forms making it an Admin nightmare. Also i wanted to use it for email error handling.

 

The script on the on select for the button to send the email looks similar to this: - 

 

PowerAppsbutton.Run("emailaddress@company.com","Help portal - " & SummaryOfIssue,OtherIssue_EmailBody,Email_Variable,"","")

 

The speechmarks at the end will be the name and content of the attachments.

 

Please help as I've been at this for hours 😞

1 ACCEPTED SOLUTION

Accepted Solutions
Adam_F
Frequent Visitor

I've managed to find the solution to the problem without going through SharePoint and using the Power apps blob as a storage mechanism within collections.

 

I converted the attachments to JSON and when referring to the attachment content portion (ContentBytes), i had to use the dataUriToBinary command. It seemed to be the only way i could get emails to read the correct format of attachments from Power Apps.

 

The trick to sending multiple attachments was to use the "Append to array variable" for the attachments above the email and then refer to the variable in the attachments section of the email object:

 

Adam_F_0-1600188943303.png

 

Adam_F_2-1600189131619.png

I hope this will help someone else,

 

Adam.

View solution in original post

5 REPLIES 5
RossB
Microsoft
Microsoft

Hello,

 

I would agree, there is plenty of information out on the Internet regarding SP as it would apply to your scenario, but I'm not seeing anything regarding using a Flow to send attachments from Azure BLOB.

 

I have a couple questions for you.

 

1.  Why are you using Azure BLOB to store attachments?

2.  Do users upload these attachments to Azure BLOB from the App?

3.  If that's the case, does the user that uploads the images need to then send those via email?

 

Thanks!

 

Adam_F
Frequent Visitor

Hi Ross,

 

Aren't the collections used in Power apps using blob storage?

 

I'd rather do the most efficient route possible. So preferably, use the built in collection to temporarily store the images / documents in the app and then use flow to send the email with attachments on.

 

The app will allow the user to upload directly into the collection storage (Blob?) and after they have filled in the text boxes on the canvas, they will click a button that initiates power automate that will send an email to a person dealing with the query and then a confirmation email back to the user.

 

I hope this makes sense.

I have a couple more questions for you regarding your ask.

1. Are you using images or documents? If you are using both, what kind of documents are you loading into the app?

2. How are you loading your documents into your App? Please explain in detail.

 

The reason I'm asking this question is because sending multiple images using Power Automate, but I need a little more information about the documents piece.

Adam_F
Frequent Visitor

Hi Ross,

 

Images and Documents are used. The documents will be screenshots so .png, ,bmp, .jpg, Excel documents, Word documents, PDF's, .msg files (Emails).

 

Files are loaded in via the attachments control that you get by adding a link to a SharePoint site within the canvas:-

Adam_F_1-1598458405834.png

Once a user click "Attach file", a dialog opens to attach a file that they choose from a location. This defaults to "All" files, unlike the image control. Once the file is uploaded, it adds it to a collection.

 

The closest i have gotten to getting something working so far, is by linking to a SharePoint site and moving the files across via JSON. This is however, creating a separate list item for every image. If i were to do it the SharePoint way, i would want 1 list item to be created and multiple attachments to be associated to it then email only those attachments in that list item. My concern would be that the email would include everything from that SharePoint list rather than the documents the user has sent in that session of running the app. Does each flow have the concept of a session that won't email others users attachments to the wrong person?

 

I hope that makes sense,

Adam.

Adam_F
Frequent Visitor

I've managed to find the solution to the problem without going through SharePoint and using the Power apps blob as a storage mechanism within collections.

 

I converted the attachments to JSON and when referring to the attachment content portion (ContentBytes), i had to use the dataUriToBinary command. It seemed to be the only way i could get emails to read the correct format of attachments from Power Apps.

 

The trick to sending multiple attachments was to use the "Append to array variable" for the attachments above the email and then refer to the variable in the attachments section of the email object:

 

Adam_F_0-1600188943303.png

 

Adam_F_2-1600189131619.png

I hope this will help someone else,

 

Adam.

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Top Kudoed Authors
Users online (38,892)