Users are receiving emails even when everything is set up to not send email notifications

This morning I’ve discovered that in the past 2 weeks we have burned through over 5000 email credits because barely ~60 users of our ~1000 active ones have activated email notifications.

I’ve disabled email from the admin settings with retroactive action for everyone and added a CSS to hide the email settings from the user control panel.

This is a screenshot of the setting. It was already like this before but I’ve set it again as to trigger the modal that ask if I want to retroactively change settings for existing users.

I also opened a topic explaining the users the reason for this change and that unfortunately discourse doesn’t allow fine grained control on which email I can send from my own forum so I either allow everyone to set whatever they want or only staff (or nobody but that’s quite the useless option apart in very specific edge cases).

One of the users that replied told me they are still receiving emails.
The reset I’ve executed was around 10am. This is a screenshot of this user’s inbox

I impersonated the user to be sure there wasn’t some issue and enabled the visibility for the setting again to verify and, indeed, the settings have not being changed despite the options in admin panel telling me they would.

Is there any rails command I can run to be sure any user have those option turned off (set to never) as they are supposed to be?


When applying the changes historically it would only reset the default value for those who had not picked a preference manually so as not to override any invidual choices (eg. turning on email for those who had opted out). The number it provides should tell you how many users it affected, which would be only those elligible and not necessarily the total amount of users.

You should be able to set the values using the rails console for those user preferences. :+1: There should be some tips in this topic Edit a user preference for everyone or a subset of users


Just in case anyone needs this. I don’t know anything about ruby and seems that old topics in this forum are outdated.

Currently, the psql query to properly reset those option for every single user is:

UPDATE user_options SET email_messages_level = 2, email_level = 2, email_previous_replies = 2;

Here’s the rails way:

UserOption.all.update_all(email_messages_level: 2, email_level: 2, email_previous_replies: 2)

8 posts were split to a new topic: Make the ‘change default historically’ text clearer

5 posts were split to a new topic: Improving Discourse documentation

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.