我注意到许多网站抱怨没有定义 Mailgun API 密钥,但(至少大多数)这些网站通过邮件接收器容器接收回复,并且它会处理这些退信,因此不需要 API 密钥(以及 Mailgun 上的相应 webhook)。看起来规范(以及代码)中的逻辑是颠倒的:
显示这个:
context "when using Mailgun without an API key" do
let(:replies_enabled) { true }
let(:mailgun_address) { "smtp.mailgun.org" }
let(:api_key) { nil }
it do
expect(check).to have_a_problem.with_priority("low").with_message(
"The server is configured to send emails via Mailgun but you haven't provided an API key used to verify the webhook messages.",
)
end
如果我们启用了回复,它会抱怨,但在这种情况下,我们不需要 webhook,并且
context "when replies are disabled" do
let(:replies_enabled) { false }
let(:mailgun_address) { anything }
let(:api_key) { anything }
it { expect(check).to be_chill_about_it }
end
在这里,我们没有使用邮件接收器处理退信,并且我们对此感到满意。
是我糊涂了还是这是颠倒的?
好吧,也许是我糊涂了。邮件接收器似乎没有将退信通知 Discourse。一个繁忙的网站没有最近的退信。
但是:
和:
因此,这些文档表明,如果您有一个有效的邮件接收器,它应该处理这个问题。我曾经在我的一些内部工具中编写的代码,这些代码设置了这些 webhook,说“# 当我们有邮件接收器时不需要 webhook”。