重构邮件:测试 rake 任务输出

I recently went through the emails:task and related code with the aim of testing each of the failure codepaths and touching up the error text.

I also discovered that the effects of setting DISCOURSE_SMTP_ENABLE_STARTTLS=false are (mostly) nil. Setting this didn’t actually disable STARTTLS and in fact, it can coexist just fine with tls at connect time (DISCOURSE_SMTP_FORCE_TLS=true).

So I’ve:

Before I merge this though, I think an admin warning in the dashboard for when DISCOURSE_SMTP_ENABLE_STARTTLS=false is being set is suitable. I imagine there’s at least one self-hoster out there who has set this but doesn’t need it and is actually relying on STARTTLS.

2 个赞

That sounds like good work! One thing that I (think I’ve) noticed is that the rake task doesn’t actually use the same code as the actual sending does (like from the /admin/email test page). I’m pretty sure that I’ve had a case where it worked in the UX but not the rake task (or maybe it was the opposite?)

While it’s fresh on your mind, it you could see that at least when it actually sends it does so using the same code that Discourse does, that would be great.

2 个赞

We’re also working on that, and on improving the logging when a queued email job fails. :+1:

3 个赞