What would cause some posts not to be sent out in mailing list mode

On a current self-hosted release of discourse, I have topics where posts are not being sent out to some of the users who have opted in to get all posts via email in mailing list mode.

I’ve checked my email logs, there are definitely emails going out for posts in this topic to some users but not to others who have also opted in to getting emails of all posts; one of my test user accounts is getting them, but not another test user.

I’ve tried posting to the topic several times, and so has at least one other person.

I don’t see any site or user settings that could be causing this, what am I not seeing?

These are the posts:

  id   | user_id |          timezone
--------+---------+----------------------------
 119197 |     586 | 2023-04-03 11:05:41
 119198 |       2 | 2023-04-03 11:12:03.207053
 119215 |       2 | 2023-04-03 15:42:45.195223
 119216 |       2 | 2023-04-03 16:18:22.664227
 119218 |     508 | 2023-04-03 16:55:42.167977
 119219 |       2 | 2023-04-03 16:56:00.140777
 119222 |       2 | 2023-04-03 18:11:33.953314
(7 rows)

These are the emails sent to user 703 (from email_logs table)

 id  | post_id |  email_type  |          timezone          |      smtp_transaction_response
-----+---------+--------------+----------------------------+--------------------------------------
 242 |  119197 | mailing_list | 2023-04-03 11:18:55.832126 | 250 2.0.0 Ok: queued as C95C443350B8
 243 |  119198 | mailing_list | 2023-04-03 11:22:04.731579 | 250 2.0.0 Ok: queued as B0E2943350B8
(2 rows)

These are all the emails sent for those posts:

 id  | post_id |  email_type  | user_id |          timezone          |      smtp_transaction_response
-----+---------+--------------+---------+----------------------------+--------------------------------------
 242 |  119197 | mailing_list |     703 | 2023-04-03 11:18:55.832126 | 250 2.0.0 Ok: queued as C95C443350B8
 243 |  119198 | mailing_list |     703 | 2023-04-03 11:22:04.731579 | 250 2.0.0 Ok: queued as B0E2943350B8
 276 |  119215 | mailing_list |       5 | 2023-04-03 15:52:47.834189 | 250 2.0.0 Ok: queued as B51B443350B8
 277 |  119216 | mailing_list |       5 | 2023-04-03 16:28:29.651872 | 250 2.0.0 Ok: queued as 8760743350B8
 281 |  119218 | mailing_list |       5 | 2023-04-03 17:05:43.582886 | 250 2.0.0 Ok: queued as 8209143350B8
 282 |  119219 | mailing_list |       5 | 2023-04-03 17:06:02.231359 | 250 2.0.0 Ok: queued as 201A243350B8
 287 |  119222 | user_replied |     508 | 2023-04-03 18:21:38.024441 | 250 2.0.0 Ok: queued as EDE47434362C
 288 |  119222 | mailing_list |       5 | 2023-04-03 18:21:38.074723 | 250 2.0.0 Ok: queued as 07474434362D
(8 rows)

User ID 5 wasn’t added to the list of copied users until I noticed the issue on another topic

This appears to be happening on nearly half of the topics/posts made today. This system just went live yesterday, but I didn’t see anything like this during testing.

I tried setting max emails per user per day to 0 to disable it, though it was previously at 100, which it doesn’t seem it would have reached.

Update: That did not fix it.

Shouldn’t it be logging a reason for not sending the email somewhere?

Yes: Settings → Logs → Error Logs

Nothing in the error log about this, nor anything near the timestamps of when the missing emails should have been sent.

Could this be a sidekiq issue? I’ve got many messages about sidekiq using too much memory today.

It looks like the topic is getting confused, once there’s a post in that topic that isn’t sent out to this user, there aren’t any future posts sent out to that user, either.

It appears topic_user.notification_level has been set to 0 (muted?) for this user/topic, and there doesn’t appear to be a way to set it back to 1 from the admin screens, though it can probably be done with rails. But how did it get changed?

Could this have been the result of someone clicking on the ‘unsubscribe’ link in the email, before I figured out how to suppress it from the emails going to the relay server? If so, shouldn’t there be a way to undo that?

Removing all tags in the two affected topics or setting notification to something other than muted doesn’t seem to have changed topic_users.

Nothing shows up in the muted topics in this user’s profile.

I’m not sure I want to just bulk change all topics, here’s the count on the values of notification_level in topic_users:

 notification_level | count
--------------------+--------
                  0 |      2
                  1 |    177
                  2 |     45
                  3 | 119818

Yay, I finally found where to unmute those topics for that user!

I had to notice that there was a ‘show’ tag above the muted box in the left column of the tracking page for this user.

Won’t they have muted that topic on purpose and don’t want to receive notifications/emails about it?

No, because it was in essence a staff account that I set up for the express purpose of forwarding posts from one group to an external legacy mailing list, and as far as I know I never intentionally muted that user on that topic.

But at least I learned a bunch about the data structure, read through some Ruby code and learned a few things about being an admin. :wink:

I think this topic can be closed now.