我已经为我的自托管站点安装了 discourse mail-receiver 以允许通过电子邮件回复。我在日志中收到以下弃用警告。
弃用通知:警告:email 参数已被弃用。此路由的所有 POST 请求都应改用 base64 严格编码的 email_encoded 参数发送。email 已收到并已排队等待处理(将于 Discourse 3.3.0 中移除)
在 /var/www/discourse/vendor/bundle/ruby/3.3.0/gems/actionpack-7.2.2.1/lib/action_controller/metal/basic_implicit_render.rb:8:in `send_action`
我正在运行最新的 Discourse 3.5.0.beta3-dev,所以弃用版本是错误的,但它仍然看起来很吓人,可能会随时中断。
源代码中的弃用在此处:here
并且在此处:here 是 mail-receiver 中需要更改以使用 base64 编码的行。如果您需要 PR,请告诉我。
one1
2026 年8 月 10 日 15:16
2
[注意:我请 ask.discourse.org 根据一次故障排除对话撰写了此帖。]
我一直在调查我自建站点上的“mail-receiver 关于 ‘email’ 参数的弃用警告 ”问题,并想分享我已确认的情况,希望能有助于推动修复的发布。
症状
通过 mail-receiver 接收的每一封邮件都会在日志中产生以下信息:
DEPRECATION NOTICE: warning: the email parameter is deprecated. all POST requests to this route should be sent with a base64 strict encoded email_encoded parameter instead. email has been received and is queued for processing (removal in Discourse 3.3.0)
At /var/www/discourse/vendor/bundle/ruby/3.4.0/gems/actionpack-8.0.5.1/lib/action_controller/metal/basic_implicit_render.rb:8:in `ActionController::BasicImplicitRender#send_action`
我在服务器上已验证的内容
/var/discourse/containers/mail-receiver.yml 中的 base_image: discourse/mail-receiver:release — 因此我运行的是 release 分支,而非某个固定的旧版本。
docker ps 显示 local_discourse/mail-receiver 与标准应用容器一起运行。
docker image inspect local_discourse/mail-receiver --format '{{.Created}}' → 2026-08-08T08:41:54Z — 几天前刚通过 ./launcher rebuild mail-receiver 重新构建。
弃用通知在 release 分支的重新构建后仍然存在 。
结论
该警告来自 mail-receiver 的 当前最新 release 版本 ,其本身仍使用已弃用的 email 参数发送原始邮件,而不是端点现在期望的 base64 严格编码的 email_encoded 参数。据我所知,当前运行的 release 镜像中没有任何内容能解决此问题。
这只是一个弃用通知(并非错误),邮件仍会正常排队和处理,因此不会导致我的站点崩溃 — 但我非常希望看到 mail-receiver 代码得到更新,以消除该警告。问题出在 discourse_mail_receiver.rb 中,它发送的是 email 参数而非 email_encoded。
请问在 mail-receiver 的 release 镜像中发布此修复的时间表是什么?
1 个赞
Ethsim2
(Ethan )
2026 年8 月 11 日 13:32
3
更新:我已经为此提交了一个 PR:
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.
mail-receiver 仍然使用已弃用的 email 参数发送原始消息。该 PR 将其更改为使用 email_encoded: Base64.strict_encode64(...) 发送消息,正如 Discourse /admin/email/handle_mail 端点所要求的那样。
我还添加了一个回归测试,检查是否提交了 email_encoded,并且不再使用已弃用的 email 参数。
mail-receiver 测试套件以及格式化/lint 检查在本地均通过。