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?
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.
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? :
If you meant that, there is no way for me to put +1 there. If it’s somewhere else, it’s me who missunderstood.