将mail-receiver更新到正式版本

如果您是因为在管理仪表板上看到此消息而来到这里:

我们检测到 mail-receiver 版本过旧。

那么您来对地方了。

请登录您的 Discourse 服务器并运行以下两条命令以更新 mail-receiver:

sed -i 's/mail-receiver:.*/mail-receiver:release/' /var/discourse/containers/mail-receiver.yml
/var/discourse/launcher rebuild mail-receiver

如需更多详情,请继续阅读。

为什么我们需要更新 mail-receiver?

我们需要将 mail-receiver 更新到不再使用 已弃用的 API 身份验证方法 的较新版本。

在您 最初设置 mail-receiver 时,系统要求您创建一个包含硬编码版本号 containers/mail-receiver.yml 文件:

base_image: discourse/mail-receiver:x.x.x

为了在未来接收更新时无需手动更改此版本号,您可以将版本号更新为 release,而不是指定具体版本。

请编辑 /var/discourse/containers/mail-receiver.yml 文件,使其使用以下基础镜像:

base_image: discourse/mail-receiver:release

如果您愿意,也可以直接运行以下命令:

sed -i 's/mail-receiver:.*/mail-receiver:release/' /var/discourse/containers/mail-receiver.yml

该命令将自动为您编辑文件。

然后,您可以运行:

/var/discourse/launcher rebuild mail-receiver

以更新到 mail-receiver 的最新版本。

21 个赞

Thanks for the update guide @blake! However, I seem to not have the mail-receiver.yml file in /var/discourse/containers/ for some reason.

root@nomadgate-community-eu:/var/discourse# sed -i 's/mail-receiver:.*/mail-receiver:release/' /var/discourse/containers/mail-receiver.yml
sed: can't read /var/discourse/containers/mail-receiver.yml: No such file or directory

For good measure checked typed ls to check what’s actually there:

root@nomadgate-community-eu:/var/discourse/containers# ls
app.yml  app.yml.save

Any idea why there’s no mail-receiver.yml file and what I can do about it? Mail Receiver seems to be working for my community, even without the file…

EDIT: Come to think of it, I don’t think I’ve ever set up “mail-receiver”. I’m using SendGrid’s inbound parse webhook feature, so why am I even seeing this error in my Discourse dashboard?

However, to make that work I am passing the API credentials as URL parameters like so: /admin/email/handle_mail?api_key=xxx&api_username=xxx — will this no longer work? And if so, is there any other way to keep the support for inbound messages via SendGrid?

2 个赞

我同意——在我的 Discourse 安装中,我没有看到 containers/mail-receiver.yml 文件。到目前为止,我没有发现任何不良影响。

@dltj 您是否也在使用 SendGrid 或类似的服务?

关键在于:如果您没有安装邮件接收器,则无需对其进行升级。

2 个赞

好的,但我正在尽可能多地收集信息,因为根据 SendGrid 或其他可配置到此端点的提供商的支持情况,基于查询参数的 API 调用可能会有一些变更。

3 个赞

不,我没有使用 SendGrid——这个 Discourse 安装已经运行了好几年,当时我编写了一个 AWS Lambda 函数,利用 /admin/email/handle_mail API 将收到的邮件推送到 Discourse。那个 Lambda 脚本使用的是 Python 2.7,因此现在应该重写一下了……或许也是时候看看现在有哪些可选方案了。

奇怪的是,Discourse 管理仪表板上已经不再显示“检测到旧版本的邮件接收器……”这条消息了。咦。 等等,这条消息还在。也许是因为在 /admin/email/handle_mail 端点连续几天没有收到任何传入邮件,所以消息暂时消失了,但在我发送测试邮件时它又出现了?

刚刚确认过——传入邮件到 Discourse 的功能仍然正常。

1 个赞

正确。如果在 24 小时内没有收到任何消息,它将会超时。

2 个赞

啊,我明白了。所以仪表盘警告并不是因为我使用了’mail-receiver’……而是因为我正在使用现已弃用的 api_keyapi_username 作为查询参数传递给 API 端点。好的……修复起来很简单。感谢您的提示。

3 个赞