# All email disabled after restoring backup?

**URL:** https://meta.discourse.org/t/all-email-disabled-after-restoring-backup/109742
**Category:** Feature
**Created:** [February 21, 2019, 10:09am UTC](https://meta.discourse.org/t/all-email-disabled-after-restoring-backup/109742 "2019-02-21T10:09:20Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![sau226](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sau226/32/302324_2.png) [@sau226](https://meta.discourse.org/u/sau226)
#### Post date: [February 21, 2019, 10:09am UTC](https://meta.discourse.org/t/all-email-disabled-after-restoring-backup/109742/1 "2019-02-21T10:09:20Z")

</div>

I wanted to do some testing with Discourse so I took a backup of my instance, wiped the DB (`rm -fr /var/discourse/shared`) and rebuilt the container.

I then created an admin user again and instead of following the setup wizard I went straight to admin, enabled restores, uploaded the backup and restored.

For whatever reason the outgoing email is disabled by an administrator message appeared.

I can confirm that the outgoing email was never disabled on the instance where the backup was made.

I did tick the option to enable readonly mode when performing backup operations.

Is this a bug or did I mess up somewhere?

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [February 21, 2019, 11:18am UTC](https://meta.discourse.org/t/all-email-disabled-after-restoring-backup/109742/2 "2019-02-21T11:18:38Z")

</div>

You should see that message only for a short time. It should disappear after the restore has finished as long as outgoing emails weren’t disabled when you created the backup. Refreshing the page in your browser should help if the notice doesn’t disappear automatically.

* * *

I’m leaving this as #Contribute > Bug, because the way we currently disable outgoing emails before the restore is quite useless. Sidekiq is disabled during the restore, so nothing can happen during that time. And the restore overwrites the value of the `disable_email` setting. Fixing the bug would require changing the site setting after the restore.

@eviltrout You added this in [When restoring a backup, disable emails. · discourse/discourse@ccf9b70 · GitHub](https://github.com/discourse/discourse/commit/ccf9b7067135f37bde23c80456d21b2d1924f858). What’s your take on this? Should we fix the bug or remove the code? In my opinion changing a site setting after the restore would be quite unexpected, so I vote for removing. Moreover nobody complained about this problem in nearly 3 years… 😉

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [February 21, 2019, 4:22pm UTC](https://meta.discourse.org/t/all-email-disabled-after-restoring-backup/109742/3 "2019-02-21T16:22:56Z")

</div>

I think the idea was that when a restore finishes the administrator might want to poke around and make sure everything is OK. Right now emails will start going out the second it finishes and the site might not be “approved.”

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [February 21, 2019, 5:33pm UTC](https://meta.discourse.org/t/all-email-disabled-after-restoring-backup/109742/4 "2019-02-21T17:33:10Z")

</div>

So therefore this is not a bug @gerhard

---

<div class="post-metadata">

### Author: ![sau226](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sau226/32/302324_2.png) [@sau226](https://meta.discourse.org/u/sau226)
#### Post date: [February 23, 2019, 4:05am UTC](https://meta.discourse.org/t/all-email-disabled-after-restoring-backup/109742/5 "2019-02-23T04:05:16Z")

</div>

Maybe Discourse should make it a bit more clear to the admin (e.g. entry inserted in the backup log panel). The site setting for `disable_emails` is set to no while the message renders and this is confusing (admin panel says disable emails is off while the message on the top of the screen still says its disabled)

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [February 25, 2019, 3:11pm UTC](https://meta.discourse.org/t/all-email-disabled-after-restoring-backup/109742/6 "2019-02-25T15:11:31Z")

</div>

Well, I consider it a bug when a line of code doesn’t do what it’s supposed to do. 😉 Anyway, it’s fixed: [FIX: Outgoing emails were not disabled after restoring backup · discourse/discourse@dc961fe · GitHub](https://github.com/discourse/discourse/commit/dc961fecb9c28be5e8f161a82616148be6a9facc)

I made a small adjustment, because I think it’s better to disable outgoing emails only for non-staff users instead of all of them.

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [February 26, 2019, 3:11pm UTC](https://meta.discourse.org/t/all-email-disabled-after-restoring-backup/109742/7 "2019-02-26T15:11:35Z")

</div>

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