# Permitir o envio de e-mails de teste quando o correio estiver desabilitado?

**URL:** https://meta.discourse.org/t/allow-sending-test-emails-when-mail-is-disabled/103931
**Category:** Feature
**Created:** [10 Dezembro , 2018 18:53 UTC](https://meta.discourse.org/t/allow-sending-test-emails-when-mail-is-disabled/103931 "2018-12-10T18:53:07Z")
**Posts on this page:** 6
**Page:** 1

<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: [10 Dezembro , 2018 18:53 UTC](https://meta.discourse.org/t/allow-sending-test-emails-when-mail-is-disabled/103931/1 "2018-12-10T18:53:07Z")

</div>

Now that we allow sending mail to admins when mail is disabled, might we enable sending mail go ANY address in the mail test field? I’ve been wondering for longer than I care to admin why none of my mail tests were appearing in the Mailgun logs.

It turns out mail is disabled, and the mail test silently fails. Nothing in logs, nothing in skipped. I was just writing a mean note to Mailgun when I figured out how it was my fault.

---

<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: [11 Dezembro , 2018 04:24 UTC](https://meta.discourse.org/t/allow-sending-test-emails-when-mail-is-disabled/103931/2 "2018-12-11T04:24:56Z")

</div>

> [@pfaffman](#):
>
> It turns out mail is disabled, and the mail test silently fails. Nothing in logs, nothing in skipped. I was just writing a mean note to Mailgun when I figured out how it was my fault.

Hmm yeah we should add an explicit warning here @sam can you assign this out?

---

<div class="post-metadata">

### Author: ![rishabh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rishabh/32/179446_2.png) [@rishabh](https://meta.discourse.org/u/rishabh)
#### Post date: [17 Dezembro , 2018 13:13 UTC](https://meta.discourse.org/t/allow-sending-test-emails-when-mail-is-disabled/103931/4 "2018-12-17T13:13:47Z")

</div>

This is indeed a bit unpredictable, when `disable email` is set to `non-staff`,

- sending a test mail to an **admin** email works as expected.
- sending a test mail to any **non-admin** email fails silently.

IMO, we could:

1. allow an admin to send a test email to ANY email address
2. allow an admin to send a test email to any user (not just admins)
3. add a warning that a test email can only be sent to another admin

I like Option 1 because it’s the most obvious but 2 and 3 would also help make this less confusing.

> <https://github.com/discourse/discourse/blob/main/app/controllers/admin/email_controller.rb#L16>

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [17 Dezembro , 2018 16:37 UTC](https://meta.discourse.org/t/allow-sending-test-emails-when-mail-is-disabled/103931/5 "2018-12-17T16:37:53Z")

</div>

Sure… go with (1) sounds fine to me.

---

<div class="post-metadata">

### Author: ![rishabh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rishabh/32/179446_2.png) [@rishabh](https://meta.discourse.org/u/rishabh)
#### Post date: [19 Dezembro , 2018 03:49 UTC](https://meta.discourse.org/t/allow-sending-test-emails-when-mail-is-disabled/103931/6 "2018-12-19T03:49:13Z")

</div>

> [@pfaffman](#):
>
> Now that we allow sending mail to admins when mail is disabled, might we enable sending mail go ANY address in the mail test field?

This is now merged, thanks @pfaffman 🥳

[https://github.com/discourse/discourse/commit/c279792130e24dffbbdee8d6cbb0bad46cc13b72](https://github.com/discourse/discourse/commit/c279792130e24dffbbdee8d6cbb0bad46cc13b72)

---

<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: [19 Dezembro , 2018 05:15 UTC](https://meta.discourse.org/t/allow-sending-test-emails-when-mail-is-disabled/103931/7 "2018-12-19T05:15:04Z")

</div>


