Send email to every user at once

Hi,

I would like to do a newsletter for my app.
For that, I would like to send with the press of a button (on my admin page) an email to every user that has “yes” selected for the newsletter (so there is “yes” in a “newsletter” field in User datatype).

I am trying to find a way to select all the users to send the email but I can’t find one.
Does someone has a solution?

The to field in Send Email action accepts multiple email addresses according to: Email - Bubble Docs

You need to separate each with a comma and you can do this with Format as text.

Select the users with newletter field=yes"

Get each item’s email:
image

And format as text separated by comma ,:

Of course, probably you should have the necessary privacy settings to get each user’s email addresses like this.

Hi ardo,
In your case I think the best way is to create a loop with a backend workflow . This way each user gets 1 email with 1 recipient.

  • Create an API workflow with 2 parameters : “users” (list of users) and “iteration” (number)
  • Add an action the workflow to send email. Recipient is user:item#iteration
  • Add another action to schedule again the same API workflow, and send those parameters :
    users=users, iteration=iteration+1. Add a condition to schedule the workflow only when iteration<users:count (this way the loop will stop when all the users got an email)
  • On button click schedule the API Workflow, for the 'users" parameter do a Search on all the users + filtering all those, for “iteration” set it to 1.

I hope it helps !

2 Likes

That’s a good point. Thanks @ambroise1 . In the first solution, he can also use cc or bcc in the same way so you don’t put all emails in one. But if you want to send this on a scheduled time not from the UI, you would need a backend workflow for sure.

Thank you for your replies, but the given solutions are not working for me rn.

The thing is, that the email sends only to the current user (so my admin user, if the newsletter “yes” is selected). It’s like it doesn’t want to send to the other emails even if I select “ignore privacy rules when running the workflow”.

For your solution ambroise, I do not find where to put “iteration+1”. If I understood well, you meant here in the “iterations” where my “1” is right now exact? :
image
If you meant that, there is no way for me to put +1 there. If it’s somewhere else, it’s me who missunderstood.

Before asking you for help I tried with the help of this video but it didn’t work out : https://www.youtube.com/watch?v=2BQxKmBjzns

I don’t know which is the best solution. Either way none is working right now.