Remove smtp_should_reject & discourse-smtp-fast-rejection

AI-generated summary

The discussion revolves around removing the smtp_should_reject feature and the discourse-smtp-fast-rejection plugin due to incorrect behavior that rejects legitimate emails — particularly bounce messages (with null envelope-from) and forwarded replies. supermathie confirms the codepath is faulty and proposes removal, noting that internal discussions support this. The issue has been observed in multiple contexts, including bounce processing failures and misconfigured self-hosted setups linked here and here. Simon_Manning notes that either fix (removing the feature or plugin) independently resolves the problem. supermathie adds that many users may not update mail-receiver, so removing the feature entirely is preferable to ensure reliability across Discourse instances.

Continuing the discussion from Seeing smtp_should_reject "400 bad request" failures on bounce processing:

I’m making this topic to summarise some internal discussion we’ve had.

We’ve identified that the codepath in smtp_should_reject is not functioning correctly and causing mail to be rejected in situations where it should not be.

Specifically:

  • bounce messages (having a null envelope-from)
  • forwarded mail to mismatch (the fast-rejection check used the envelope-to, whereas Discourse uses the To/CC headers)

This has caused problems for self-hosters using this:

There’s no interest in maintaining this code so we’re looking to remove it entirely.

Discourse PR:
https://github.com/discourse/discourse/pull/36033

(this doesn’t remove the endpoint as people’s installs will be trying to hit it - it changes it to always say “do not reject”)

mail-receiver PR:
https://github.com/discourse/mail-receiver/pull/33

Both of these fixes appear to work independently of each other (i.e. getting either one will solve the problem) and neither seem to require any effort by people self-hosting beyond updating as normal, is that correct?

This is correct; my motivation is I suspect that people may not update mail-receiver as often as Discourse so I’d like to ensure those people still get the fix.