# Remove smtp\_should\_reject & discourse-smtp-fast-rejection

**URL:** https://meta.discourse.org/t/remove-smtp-should-reject-discourse-smtp-fast-rejection/389368
**Category:** Development
**Created:** [November 21, 2025, 10:41pm UTC](https://meta.discourse.org/t/remove-smtp-should-reject-discourse-smtp-fast-rejection/389368 "2025-11-21T22:41:28Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)
#### Post date: [November 21, 2025, 10:41pm UTC](https://meta.discourse.org/t/remove-smtp-should-reject-discourse-smtp-fast-rejection/389368/1 "2025-11-21T22:41:28Z")

</div>

Continuing the discussion from [Seeing smtp\_should\_reject "400 bad request" failures on bounce processing](https://meta.discourse.org/t/seeing-smtp-should-reject-400-bad-request-failures-on-bounce-processing/387431/14):

> [@Seeing smtp\_should\_reject "400 bad request" failures on bounce processing](https://meta.discourse.org/t/seeing-smtp-should-reject-400-bad-request-failures-on-bounce-processing/387431/14):
>
> I’ve reviewed the code in question and I believe you are right - I think the `smtp_should_reject` code may be incorrectly rejecting bounce messages and replies.

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:

- [Seeing smtp\_should\_reject "400 bad request" failures on bounce processing - #14 by supermathie](https://meta.discourse.org/t/seeing-smtp-should-reject-400-bad-request-failures-on-bounce-processing/387431/14)
- [Configure direct-delivery incoming email for self-hosted sites with Mail-Receiver - #482 by Carleas](https://meta.discourse.org/t/configure-direct-delivery-incoming-email-for-self-hosted-sites-with-mail-receiver/49487/482)

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](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](https://github.com/discourse/mail-receiver/pull/33)

---

<div class="post-metadata">

### Author: ![Simon\_Manning](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon_manning/32/198596_2.png) [@Simon\_Manning](https://meta.discourse.org/u/Simon_Manning)
#### Post date: [November 25, 2025, 3:01pm UTC](https://meta.discourse.org/t/remove-smtp-should-reject-discourse-smtp-fast-rejection/389368/2 "2025-11-25T15:01:41Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)
#### Post date: [November 25, 2025, 3:34pm UTC](https://meta.discourse.org/t/remove-smtp-should-reject-discourse-smtp-fast-rejection/389368/3 "2025-11-25T15:34:06Z")

</div>

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.
