Discourse/mail-receiver:release Docker image appears to be outdated

AI-generated summary

The discussion addresses issues with the discourse/mail-receiver:release Docker image, which scavin reports is nearly two years old and incompatible with current Discourse versions. The outdated image causes incoming emails to be rejected with 450 4.7.1 errors because it uses deprecated smtp_should_reject logic, whereas recent code changes in PR #33 removed this mechanism.

Scavin followed up by building the current main branch, revealing two further problems. First, the Dockerfile still configures Postfix to use unix:private/policy, which no longer exists, causing 451 4.3.5 errors. Removing this reference resolved the SMTP rejection. Second, granular API keys scoped to “receive emails” return HTTP 404s, while Global API keys work. Scavin offered to submit a PR to fix the stale Dockerfile references.

Ethsim2 confirmed the outdated nature of the release image by noting that PR #37, which switched to the email_encoded parameter, was merged in August but is missing from the published image. Consequently, their installation triggers deprecation warnings for the email parameter.

Sam acknowledged the project’s ambiguous maintenance status, explaining that Discourse internally uses a different image, while the public release image for self-hosters often lags. He considered either abandoning the public Docker publication or transferring maintenance. In response, Jagster urged the team to maintain the image due to its importance for self-hosters. pfaffman expressed interest in using the internal image and noted missing bounce-handling features.

Finally, David reported that an updated copy of mail-receiver has been published, resolving the issue.

Hi,

I think the official discourse/mail-receiver:release Docker image may have been overlooked and has not been rebuilt for quite some time.

The GitHub repository is still actively maintained:

However, the official Docker image:

discourse/mail-receiver:release

appears to have been built almost 2 years ago.

This seems to cause compatibility problems with current versions of Discourse.

In my case, incoming email reaches the mail receiver successfully, but it is rejected during RCPT TO with:

450 4.7.1 Recipient address rejected: Internal error, API request failed

The old Docker image still appears to use the smtp_should_reject / fast-rejection mechanism.

However, the current Discourse source contains this comment:

# this endpoint has been broken for years
# and was used only in the public mail-receiver's fast rejection code,
# which is removed in https://github.com/discourse/mail-receiver/pull/33

PR #33 has already removed that fast-rejection code from mail-receiver, but those changes do not appear to be included in the currently published discourse/mail-receiver:release image.

The official mail-receiver documentation/README still instructs users to use:

discourse/mail-receiver:release

So I wonder if the Docker image publishing process was simply missed after the recent changes.

Could you please check whether a new discourse/mail-receiver:release image needs to be built and published?

Thanks!

3 likes

Update: I tested the current main branch

I built the current main branch locally and found another issue.

The old Docker Hub release image still runs the old fast-rejection code and fails during RCPT with:

450 4.7.1 Recipient address rejected: Internal error, API request failed

However, the current main branch has already removed the smtp_should_reject / fast-rejection implementation. After building main, Postfix instead fails with:

warning: connect to private/policy: No such file or directory
451 4.3.5 Recipient address rejected: Server configuration problem

I traced this to two remaining references in the Dockerfile:

check_policy_service unix:private/policy

The policy service itself has been removed, but smtpd_recipient_restrictions still references its socket.

I removed unix:private/policy from smtpd_recipient_restrictions, rebuilt the image, and incoming SMTP mail was then accepted successfully.

After switching to a Global API Key, delivery to Discourse also succeeded:

dsn=2.0.0, status=sent (delivered via discourse service)

So there seem to be two separate issues:

  1. The published discourse/mail-receiver:release image is outdated and still contains the old fast-rejection implementation.
  2. The current main branch removed that implementation, but the Dockerfile still configures Postfix to use unix:private/policy.

There may also be a separate issue with granular API keys: a key scoped only to receive emails returned HTTP 404 from /admin/email/handle_mail, while a Global API Key returned HTTP 200.

I can submit a PR for the two stale private/policy references in the Dockerfile if that would be helpful.

2 likes

I can confirm the outdated release image from another change in mail-receiver.

I opened this PR, which was merged on 11 August: FIX: Use email_encoded for incoming mail - Pull Request #37 - discourse/mail-receiver - GitHub

It changes the mail receiver from:

post.set_form_data(email: @mail)

to the newer email_encoded parameter expected by Discourse.

After the PR was merged, I rebuilt mail-receiver on 17 August, but the freshly rebuilt container still contained:

post.set_form_data(email: @mail)

I added the details to the merged PR here:

I rebuilt again on 22 August and ./launcher rebuild mail-receiver reported the published release image as up to date, with digest:

sha256:2a0d45bb92a783c846a821e635413764eeadb3441ef6190085545a4bf054cb1e

Incoming mail still works on my installation, but each received email continues to trigger Discourse’s:

the email parameter is deprecated

warning because the published image does not contain the merged #37 change.

So this appears to independently confirm the first issue you’ve found: changes merged into the mail-receiver repository have not been making it into the published discourse/mail-receiver:release image.

2 likes

Discussing internally, I agree the project is in a weird state… is it maintained? is it not maintained? it is hard to tell.

Internally we use a different image, this one is only for self hosters and often updates lapse.

Trying to figure out if we give up the docker publication here and move to someones personal account, or maintain this thing.

1 like

Maintain this thing, please. It is needed and relatively much used.

3 likes

It would be great if that one could somehow work for self-hosters.

I miss the old version that properly handled bounces and notified Discourse not to send those. It obviated the need for mailgun API updates, which I don’t quite understand on a multisite setup.

An updated copy of mail-receiver has now been published (Mail-Receiver not getting updated release designations in GitHub - #4 by david)

1 like