# משתמשים מקבלים מיילים גם כאשר הכל מוגדר כך שלא יישלחו התראות בדוא"ל

**URL:** https://meta.discourse.org/t/users-are-receiving-emails-even-when-everything-is-set-up-to-not-send-email-notifications/259835
**Category:** Support
**Created:** [29 במרץ,‏ 2023,‏ 11:12am UTC](https://meta.discourse.org/t/users-are-receiving-emails-even-when-everything-is-set-up-to-not-send-email-notifications/259835 "2023-03-29T11:12:28Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Crius](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/crius/32/317214_2.png) [@Crius](https://meta.discourse.org/u/Crius)
#### Post date: [29 במרץ,‏ 2023,‏ 11:12am UTC](https://meta.discourse.org/t/users-are-receiving-emails-even-when-everything-is-set-up-to-not-send-email-notifications/259835/1 "2023-03-29T11:12:28Z")

</div>

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.

 ![image](https://global.discourse-cdn.com/meta/original/4X/c/c/2/cc29da28a542469972bf0d62db895f2145cd748e.png)

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

 ![image](https://global.discourse-cdn.com/meta/original/4X/3/4/4/344627a41bbfccaabe3cff4cf56f345a1f7a7d69.png)

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.

 ![image](https://global.discourse-cdn.com/meta/original/4X/a/5/2/a524d2c747b709009261d14e09af25e15cb09de7.png)

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?

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [29 במרץ,‏ 2023,‏ 11:26am UTC](https://meta.discourse.org/t/users-are-receiving-emails-even-when-everything-is-set-up-to-not-send-email-notifications/259835/2 "2023-03-29T11:26:47Z")

</div>

> [@Crius](#):
>
> 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.

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. 👍 There should be some tips in this topic [Edit a user preference for everyone or a subset of users](https://meta.discourse.org/t/edit-a-user-preference-for-everyone-or-a-subset-of-users/25162#stop-sending-emails-to-active-users-4)

---

<div class="post-metadata">

### Author: ![Crius](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/crius/32/317214_2.png) [@Crius](https://meta.discourse.org/u/Crius)
#### Post date: [29 במרץ,‏ 2023,‏ 11:26am UTC](https://meta.discourse.org/t/users-are-receiving-emails-even-when-everything-is-set-up-to-not-send-email-notifications/259835/3 "2023-03-29T11:26:59Z")

</div>

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:

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

```

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [29 במרץ,‏ 2023,‏ 2:18pm UTC](https://meta.discourse.org/t/users-are-receiving-emails-even-when-everything-is-set-up-to-not-send-email-notifications/259835/4 "2023-03-29T14:18:58Z")

</div>

> [@Crius](#):
>
> the psql query to properly reset those option for every single user is

Here’s the rails way:

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

```

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [15 באפריל,‏ 2023,‏ 9:29am UTC](https://meta.discourse.org/t/users-are-receiving-emails-even-when-everything-is-set-up-to-not-send-email-notifications/259835/5 "2023-04-15T09:29:03Z")

</div>

8 posts were split to a new topic: [Make the ‘change default historically’ text clearer](https://meta.discourse.org/t/make-the-change-default-historically-text-clearer/261780)

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [15 באפריל,‏ 2023,‏ 9:30am UTC](https://meta.discourse.org/t/users-are-receiving-emails-even-when-everything-is-set-up-to-not-send-email-notifications/259835/13 "2023-04-15T09:30:28Z")

</div>

5 posts were split to a new topic: [Improving Discourse documentation](https://meta.discourse.org/t/improving-discourse-documentation/261781)

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [15 במאי,‏ 2023,‏ 9:31am UTC](https://meta.discourse.org/t/users-are-receiving-emails-even-when-everything-is-set-up-to-not-send-email-notifications/259835/14 "2023-05-15T09:31:15Z")

</div>

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