Hi Rik,
to send an email to all email addresses in a Gallery you need to loop through your gallery using the ForAll function:
Forall(yourGallery.AllItems(),Office365Outlook.SendEmail(ThisItem.emailaddress, subject, body))
don't forget to add the Office365Outlook connection to your app!
This sends a separate email to every email address in your Gallery. If you want to just send 1 mail to all recipients you need to capture these email addresses in a variable using the same ForAll() loop and outside the loop send the email using that variable in the TO field.
Hopefully this makes sense?
You can find different examples when you search on "Email based on Gallery items" on the web
------------------------------
Koen Mathijs
------------------------------
Original Message:
Sent: Feb 10, 2023 09:18 AM
From: Rik Forgo
Subject: Gather email addresses from gallery
Thanks Koen, maybe it would be better if I explained in a more visual way. Here's the layout of my app:
The first gallery on the left drives the content for the second gallery on the right. I would like to gather all the email addresses in this gallery's found set (the ones that have an email address) and insert them into an mail sendto script. It's unclear how I might do this. Suggestions?
Rik
------------------------------
Rik Forgo
Writer/Editor
Original Message:
Sent: Feb 10, 2023 03:50 AM
From: Koen Mathijs
Subject: Gather email addresses from gallery
Rik,
I would like to collect the contents of the email_address field in one table --> does this mean that the email address is only stored in 1 table?
Not sure what you are trying to accomplish in Powerapps, the Gallery is only for viewing purpose. You can easily show every row of your table and include the email address, it will be blank or not.
To actually send an email to all email addresses, I would use Power Automate. Just loop through your table and gather every email address in an array and then join those email addresses in a string, joined with the ";" to produce a variable that you can use in the TO field of your email.
If you like you can use PowerApps to trigger this Flow and send out the email.
------------------------------
Koen Mathijs
Original Message:
Sent: Feb 09, 2023 07:29 AM
From: Rik Forgo
Subject: Gather email addresses from gallery
I have two galleries on one layout using two PowerApps custom tables as sources; they contain general contact information, including email addresses. I would like to collect the contents of the email_address field in one table to populate an email that will be spawned by the process. Not every row will have an email address, but I would need to gather up the ones that do. How would I gather all the available email values in the gallery?
------------------------------
Rik Forgo
Writer/Editor
------------------------------