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

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!

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.