How to list emails for users in a group?

Just that. There is a way to e-mail all the group or list the email of entire custom group?

Thanks!

One way is to use the data explorer plugin.

I can do it from SQL right? I have access to the server. Maybe you can share the query to display that input?

Thanks for your quick reply.

The data explorer plugin offers some support in building such queries. It’s a little complicated, as you need to join a couple tables to get the email address. It’s beyond what I have time for, but there might be examples in the data explorer category.

That’s the Query Explorer code to run. It shows a selector to choose between all the groups and it can be used with Workflows and the entire Discourse system.

-- [params]
-- group_id :group_id

WITH user_groups AS (
    SELECT gu.user_id
    FROM groups g
    JOIN group_users gu ON gu.group_id = g.id
    WHERE g.id = :group_id
    GROUP BY gu.user_id
)
SELECT ue.email
FROM users u
INNER JOIN user_emails ue ON u.id = ue.user_id
INNER JOIN user_groups ug ON u.id = ug.user_id
WHERE u.id > 0
ORDER BY u.id DESC