Situation
reply_by_email_enableddisabled, we do not want people to reply by email- an admin-only category for notifications from an external system
- the category has an email address set up
email_inis enabled- emails are sent to the email address of the category
- emails are bouncing with
BadDestinationAddress
The cause
After an hour of debugging, I came across the following FIX: Disallow replies to categories when reply by email disabled (#33… · discourse/discourse@e05ef50 · GitHub
FIX: Disallow replies to categories when reply by email disabled (#33641)
When the reply_by_email_enabled setting is set to false, we no longer include a reply link in e-mail notifications. However, we do not prevent actual e-mails to a configured email_in address associated with a category. This change into consideration the setting in Email::Receiver#check_address.
and the affected code will no longer return a category if reply_by_email_enabled is not enabled.
def self.check_address(address, include_verp = false)
# only check for a group/category when 'email_in' is enabled
if SiteSetting.email_in
group = Group.find_by_email(address)
return group if group
category = Category.find_by_email(address)
return category if category && SiteSetting.reply_by_email_enabled? <-- added
end
Why? 
I have so many questions:
- why this change? At all? It only makes the system more inflexible. If I don’t want people to email to a category, then I would simply remove the email address from the category?
- why is this implemented this way?
- apparently email in to groups is not a problem?
- if
reply_by_email_enabledis false then there is no need to even look up the category? - by not returning the category the error becomes
BadDestinationAddresswhich is VERY wrong and REALLY hard to debug
- the setting this now suddenly depends on, is called reply by email. That is not what I am doing.
- the same confusion is visible in the title of the PR, which is called “disallow replies to categories”, which is not what this is about (in Discourse a “reply to a category” is not even possible).
Besides the way this was implemented, I honestly fail to see the point.
I cannot think of ANY situation where simply removing the email address from the category would not do the job if one wants to prevent people from emailing to a category. And the implication of this is that it has now become impossible to have a category receiving emails without enabling site-wide reply by email.
If there is a really good reason that I am missing, feel free to recategorize as Feature