List all users with a given email domain

I am having trouble diagnosing strange non deliverability of mail to all users in Nederlands with .nl domains.

How can I get a list of emails of users with a given domain, or even a regex?

You should be able to do this by going to the admin - active users list at your-site/admin/users/list/active then type the email domain in the search filter

also, these topics might help you:

3 Likes

@Lilly thanks. I did not say but I was really looking for some report from querying the datazbase in rails or something.

@Lilly Thanks. There is nothing wrong with our mail setup, there’s a weird issue between Amazon SES and Nederlands, where all Amazon SES outbound mails get blocked and blacklisted. It’s nothing to do with Discourse - except I wish I could see more of the SMTP error in the Error logs, which cuts off each report just where the error is about to begin. I wonder how to see the full bounce report. [Sorry I have just derailed this into a new thread.]

You can see them in the Bounced email report at yoursite/admin/email/bounced

Or you can use data explorer for finding all users of a domain, then export a csv file. maybe something like:

-- [params]
-- text :domain = example.com


SELECT u.id AS user_id, u.username, ue.email
FROM users u
JOIN user_emails ue ON u.id = ue.user_id
WHERE ue.email LIKE '%' || :domain
  AND ue.primary = true
ORDER BY u.username

Or you could make a group and automatically add them to the group

1 Like