Sending Multiple Emails

I am sure this is an easy question but I am stumped!
I have a table – usersTable – containing three fields: email, first_name and last_name. I want to be able to select more than one of the records in the table and send each a personalised email. On clicking the ‘Send Email’ button the following query runs.

The console.log shows the two selected emails correctly.


It then executes the query ‘send_email’.

Unfortunately, I cannot work out what to put in the To field so that an email is sent to each address individually. With the current entry two emails are sent to the same email address which is the first on the table. I am sure it must be to do with the variable ‘emails’ but how to get that into the To field is escaping me. Any help would be gratefully received.

In send_email the "To" should be {{ additionalScopeEmail }}. That's the variable that you are passing with additionalScope. Ignore the linting error.
Screenshot 2024-01-13 at 9.48.55 AM

Hi Matth, Thank you for your quick reply and your solution which I am not sure I would ever have got to! Also, the warning on the linting error saved a lot of head scratching. Thanks for your help - much appreciated. Alan

1 Like