# Email notification for messages

**URL:** https://meta.discourse.org/t/email-notification-for-messages/163937
**Category:** Bug
**Created:** [September 14, 2020, 8:45am UTC](https://meta.discourse.org/t/email-notification-for-messages/163937 "2020-09-14T08:45:53Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![mentalstring](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mentalstring/32/168934_2.png) [@mentalstring](https://meta.discourse.org/u/mentalstring)
#### Post date: [September 14, 2020, 8:45am UTC](https://meta.discourse.org/t/email-notification-for-messages/163937/1 "2020-09-14T08:45:53Z")

</div>

Me and some of our users are having trouble understanding the difference between these 2 options for receiving email notifications for messages:

 ![Screenshot 2020-09-14 at 09.43.25](https://global.discourse-cdn.com/meta/original/3X/e/d/ed6dab7ff550fb9a49cf0657476d4c0f5a77893a.png)

and

 ![Screenshot 2020-09-14 at 09.43.32](https://global.discourse-cdn.com/meta/original/3X/4/a/4ae3f3c92702b94573794849a9c67139f1cb5ed9.png)

From my tests, even if selecting ‘always’, no email notifications are sent if the person is around browsing the forum — even if the person did not visit their messages or opened the notifications dropdown.

Here’s a skipped email for someone who has selected to ‘always’ receive email notifications for messages:

 ![Screenshot 2020-09-14 at 09.36.44](https://global.discourse-cdn.com/meta/original/3X/5/7/57687ca18d32f31de46b0088bc103b23d179dbb4.png)

The person was browsing the forum, but did not check their messages during the 10m period (as we were aiming to understand the behavior).

So, if the ‘always’ cancels the email notifications when the person is using Discourse, what’s the difference for the ‘only when away’?

I’m aware the risk of having it as ‘always’ since perhaps too many emails notifications may be received by whoever chooses to use it. But, right now, it does not seems to be doing what one would expect ‘always’ to do. Is this behavior the intended one?

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [September 15, 2020, 12:21am UTC](https://meta.discourse.org/t/email-notification-for-messages/163937/2 "2020-09-15T00:21:44Z")

</div>

When the “Send me an email when someone messages me” user option is set to “Always”, the only time a user should not get sent an email for a PM is if the user has already read the message. In that case, the Skip Reason in the logs should be “The notification this email is about has already been read.” That should only occur if the user has actually visited the message on the site, just viewing the notification in the dropdown menu should not cause the PM to be skipped.

The “User was seen recently” Skip Reason should not be displayed for the recipients of PMs who have set their messaging level to “Always.” Are you sure that the skipped message in your screenshot is for a PM?

---

<div class="post-metadata">

### Author: ![mentalstring](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mentalstring/32/168934_2.png) [@mentalstring](https://meta.discourse.org/u/mentalstring)
#### Post date: [September 15, 2020, 1:20pm UTC](https://meta.discourse.org/t/email-notification-for-messages/163937/3 "2020-09-15T13:20:42Z")

</div>

What you describe makes sense, but it is not what we are seeing with the latest stable.

To double check, I reproduced it again just now.

Sent a message. Receiver opened the message (before the 10m) and the email notification got cancelled immediately:

 ![Screenshot 2020-09-15 at 14.04.33](https://global.discourse-cdn.com/meta/original/3X/9/0/904c15fd4f6bafd2399ac586d0fb7aff5c3dd675.png)

Tested with another message, but this time the message was not read immediately — receiver continued to browse the forum (without visiting messages); the email notification was cancelled exactly like above. From what I can see, it got cancelled almost immediately, just because the person was using the forum. No difference that I can spot.

> [@simon](#):
>
> Are you sure that the skipped message in your screenshot is for a PM?

Not sure if I understood the question. Isn’t that `user_private_message` on the screenshot only for private messages?

Not sure if this helps, but the only times I’m seeing Skipped emails with “The notification this email is about has already been read.” are for `user_mentioned` emails and not `user_private_message` ones (at least on our list of Skipped emails).

Can I provide any other info?

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [September 15, 2020, 8:57pm UTC](https://meta.discourse.org/t/email-notification-for-messages/163937/4 "2020-09-15T20:57:41Z")

</div>

> [@mentalstring](#):
>
> What you describe makes sense, but it is not what we are seeing with the latest stable

That makes sense, I’m testing this on the tests-passed branch.

> [@mentalstring](#):
>
> Not sure if I understood the question. Isn’t that `user_private_message` on the screenshot only for private messages?

Yes it is. That’s clearly a PM in your screenshot. For a user who has selected to be always emailed when someone messages them, the email should get sent as long as they haven’t read the PM through the Discourse user interface.

---

<div class="post-metadata">

### Author: ![mentalstring](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mentalstring/32/168934_2.png) [@mentalstring](https://meta.discourse.org/u/mentalstring)
#### Post date: [September 21, 2020, 3:44pm UTC](https://meta.discourse.org/t/email-notification-for-messages/163937/5 "2020-09-21T15:44:47Z")

</div>

> [@simon](#):
>
> That makes sense, I’m testing this on the tests-passed branch.

I don’t have an easy place to reproduce this with a tests-passed setup, so I had someone message me here on meta which I hope is good enough. I was using meta when the person sent the message and I continued to browse meta for over 10m (without checking messages): no email notification arrived in the meantime and I have it set to ‘always’ for private messages. Seems the same behavior I described with stable.

Can you perhaps check on the logs of Skipped emails what happened to the notification of the last message on [this](https://meta.discourse.org/t/testing-email-notifications/164620)?

> [@simon](#):
>
> For a user who has selected to be always emailed when someone messages them, the email should get sent as long as they haven’t read the PM through the Discourse user interface.

Could the mobile push notification for the message cancel the email notification? I got that immediately (not after 10m), but have not opened it (nor opened the DiscourseHub app) during the 10m interval.

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [September 22, 2020, 5:59pm UTC](https://meta.discourse.org/t/email-notification-for-messages/163937/6 "2020-09-22T17:59:08Z")

</div>

> [@mentalstring](#):
>
> Can you perhaps check on the logs of Skipped emails what happened to the notification of the last message on [this](https://meta.discourse.org/t/testing-email-notifications/164620)?

I’m not seeing an entry for that message in either the Skipped or Sent email logs on Meta. I’m not sure what the reason for that is, but the reply to your message that could have generated an email is

> hello hello hello hello hello hello hello hello

I’m not sure if posting the same word multiple times would trigger something that prevents an email from being sent.

I’ll look into this some more on my own site to make sure that emails are being sent as expected.

---

<div class="post-metadata">

### Author: ![mentalstring](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mentalstring/32/168934_2.png) [@mentalstring](https://meta.discourse.org/u/mentalstring)
#### Post date: [September 22, 2020, 6:20pm UTC](https://meta.discourse.org/t/email-notification-for-messages/163937/7 "2020-09-22T18:20:22Z")

</div>

FWIW, I asked to be sent another message. This time, more _normal looking_.

Same behavior. As long I just keep browsing meta, I don’t get the email notification for the message. As of right now (15m passed), no email arrived and I still have the new message notification since I haven’t opened it.

 ![Screenshot 2020-09-22 at 19.18.56](https://global.discourse-cdn.com/meta/original/3X/5/8/58bfbe8d252b1362162b73cd079f98f6ec92714d.png)

---

<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: [September 22, 2020, 7:55pm UTC](https://meta.discourse.org/t/email-notification-for-messages/163937/8 "2020-09-22T19:55:35Z")

</div>

> [@mentalstring](#):
>
> I was using meta when the person sent the message and I continued to browse meta for over 10m (without checking messages): no email notification arrived in the meantime and I have it set to ‘always’ for private messages.

Can we repro this here on meta @tshenry?

---

<div class="post-metadata">

### Author: ![tshenry](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tshenry/32/119495_2.png) [@tshenry](https://meta.discourse.org/u/tshenry)
#### Post date: [September 22, 2020, 9:38pm UTC](https://meta.discourse.org/t/email-notification-for-messages/163937/10 "2020-09-22T21:38:18Z")

</div>

So I’ll start by mentioning that we ship the `default email messages level` to be set as “always.” This is kind of surprising to me, but maybe the idea is that direct messages typically need as much exposure as possible.

Anyway, I just created a test account here on Meta and sent that account a PM. I continued to browse the forum under the test user account, ignoring the new message notification.

I checked the logs a couple minutes later and it looks like it is skipping:

 ![image1](https://global.discourse-cdn.com/meta/original/3X/2/c/2c66a68f08cb21011d04a6e2a7c149c5596d7b25.png)

That’s despite:

 ![image2](https://global.discourse-cdn.com/meta/original/3X/c/8/c8571f89ad61fb6cd55d62f3f9066a6bb2ea059c.png)

So to answer your question, I can indeed repro on meta!

---

<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: [September 23, 2020, 12:38am UTC](https://meta.discourse.org/t/email-notification-for-messages/163937/11 "2020-09-23T00:38:59Z")

</div>

We should maybe assign this one @sam?

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [September 24, 2020, 1:00am UTC](https://meta.discourse.org/t/email-notification-for-messages/163937/13 "2020-09-24T01:00:14Z")

</div>

Fixed via:

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

Thanks for reporting this issue @mentalstring. 👍

---

<div class="post-metadata">

### Author: ![mentalstring](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mentalstring/32/168934_2.png) [@mentalstring](https://meta.discourse.org/u/mentalstring)
#### Post date: [September 24, 2020, 10:42am UTC](https://meta.discourse.org/t/email-notification-for-messages/163937/14 "2020-09-24T10:42:50Z")

</div>

From a quick test here on meta, it does seem to work as expected now. Thank you for the fix 👍

---

<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: [September 24, 2020, 6:29pm UTC](https://meta.discourse.org/t/email-notification-for-messages/163937/15 "2020-09-24T18:29:53Z")

</div>


