scavin
(scavin)
2026 年9 月 6 日 04:30
1
你好,
我认为官方的 discourse/mail-receiver:release Docker 镜像可能被忽略了,已经很长时间没有重新构建了。
GitHub 仓库仍在积极维护中:
通过在 GitHub 上创建帐户来为 discourse/mail-receiver 开发做出贡献。
然而,官方的 Docker 镜像:
discourse/mail-receiver:release
似乎是在将近 2 年前 构建的。
这似乎导致与当前版本的 Discourse 存在兼容性问题。
在我的情况下,传入的邮件可以成功到达邮件接收器,但在 RCPT TO 阶段被拒绝,错误信息为:
450 4.7.1 Recipient address rejected: Internal error, API request failed
旧的 Docker 镜像似乎仍然在使用 smtp_should_reject / 快速拒绝机制。
然而,当前的 Discourse 源代码中包含以下注释:
# 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 已经将该快速拒绝代码从 mail-receiver 中移除,但这些更改似乎并未包含在当前发布的 discourse/mail-receiver:release 镜像中。
官方 mail-receiver 文档/README 仍然指示用户使用:
discourse/mail-receiver:release
所以我想知道,在最近的更改之后,Docker 镜像的发布流程是否只是被遗漏了。
能否请您检查一下,是否需要构建并发布一个新的 discourse/mail-receiver:release 镜像?
谢谢!
scavin
(scavin)
2026 年9 月 6 日 05:04
2
更新:我测试了当前的 main 分支
我在本地构建了当前的 main 分支,并发现了另一个问题。
旧的 Docker Hub release 镜像仍然运行着旧的快速拒绝(fast-rejection)代码,并在 RCPT 阶段失败,报错如下:
450 4.7.1 Recipient address rejected: Internal error, API request failed
然而,当前的 main 分支已经移除了 smtp_should_reject / 快速拒绝的实现。构建 main 后,Postfix 改为报以下错误:
warning: connect to private/policy: No such file or directory
451 4.3.5 Recipient address rejected: Server configuration problem
我追踪发现,这是由于 Dockerfile 中仍有两处残留引用:
check_policy_service unix:private/policy
策略服务(policy service)本身已被移除,但 smtpd_recipient_restrictions 仍然引用了它的 socket。
我从 smtpd_recipient_restrictions 中移除了 unix:private/policy,重新构建了镜像,随后入站 SMTP 邮件便成功被接收。
在切换到全局 API 密钥(Global API Key)后,投递到 Discourse 也成功了:
dsn=2.0.0, status=sent (delivered via discourse service)
因此,似乎存在两个独立的问题:
已发布的 discourse/mail-receiver:release 镜像已过时,仍包含旧的快速拒绝实现。
当前的 main 分支虽然移除了该实现,但 Dockerfile 仍然配置 Postfix 使用 unix:private/policy。
此外,细粒度 API 密钥(granular API keys)可能还存在另一个问题:一个仅限定于 receive emails 权限的密钥从 /admin/email/handle_mail 返回了 HTTP 404,而全局 API 密钥则返回了 HTTP 200。
如果有帮助的话,我可以提交一个 PR,修复 Dockerfile 中这两处过时的 private/policy 引用。
2 个赞
Ethsim2
(Ethan )
2026 年9 月 6 日 07:01
3
我可以确认,mail-receiver 中另一处更改所使用的发布镜像已经过时。
我创建了此 PR,它已于 8 月 11 日合并:
main ← Ethsim12:fix-email-encoded
merged 01:09PM - 11 Aug 26 UTC
## What does this change?
Updates mail-receiver to send incoming MIME messages … using the
`email_encoded` parameter expected by Discourse's `/admin/email/handle_mail`
endpoint.
The message is encoded with `Base64.strict_encode64` before being added to
the form data.
This removes use of the deprecated raw `email` parameter.
## Why?
Discourse currently logs a deprecation notice for every incoming email sent
by mail-receiver:
> the email parameter is deprecated. all POST requests to this route should
> be sent with a base64 strict encoded email_encoded parameter instead
A freshly rebuilt `discourse/mail-receiver:release` still reproduces the
warning because the current mail-receiver code continues to send `email`.
## Tests
Adds regression coverage which verifies that:
- the deprecated `email` parameter is not sent
- `email_encoded` is sent
- the encoded value represents the original MIME message
Tested locally with Ruby 3.2.11:
- `bundle exec rake test` — 16 examples, 0 failures
- `bundle exec rubocop` — no offenses
- `bundle exec stree check ...` — all files matched expected format
This is related to #13, which proposed the same API migration in 2023.
This PR refreshes that change against current `main` and adds regression
coverage.
它将邮件接收器从:
post.set_form_data(email: @mail)
更改为 Discourse 期望的较新的 email_encoded 参数。
PR 合并后,我在 8 月 17 日重新构建了 mail-receiver,但新构建的容器仍然包含:
post.set_form_data(email: @mail)
我已在已合并的 PR 中添加了这些详细信息:
main ← Ethsim12:fix-email-encoded
Thanks again for merging this.
I rebuilt `mail-receiver` again today (17 August… ), but the published
`discourse/mail-receiver:release` image still appears to contain the old
implementation.
The rebuild reports the `release` image as up to date, and checking the
freshly rebuilt running container gives:
```text
# docker exec mail-receiver \
grep -n -E 'base64|set_form_data' \
/usr/local/lib/site_ruby/mail_receiver/discourse_mail_receiver.rb
40: post.set_form_data(email: @mail)
```
A newly received email therefore still produces the `email parameter is
deprecated` warning in Discourse.
Since #37 is merged into `main`, does the
`discourse/mail-receiver:release` Docker image need to be rebuilt/published
separately for this change to reach normal self-hosted installations?
我在 8 月 22 日再次重新构建,./launcher rebuild mail-receiver 报告发布的发布镜像是最新的,其摘要为:
sha256:2a0d45bb92a783c846a821e635413764eeadb3441ef6190085545a4bf054cb1e
在我的安装环境中,传入邮件仍然有效,但每封收到的邮件都会继续触发 Discourse 的:
the email parameter is deprecated
警告,因为发布的镜像不包含已合并的 #37 更改。
因此,这似乎独立地证实了你发现的第一个问题:合并到 mail-receiver 仓库的更改并未进入已发布的 discourse/mail-receiver:release 镜像。
1 个赞