emails:test rake 任务在禁用电子邮件时,不应报告成功发送

我无法复现因 SiteSetting.disable_emails 导致消息无法发送的问题,但我已修改脚本,仅在返回 EmailLog 时报告成功,并针对 disable_emails 设置添加了额外警告。

$ bin/rake 'emails:test[]'
Testing sending to  using localhost:1025, username: with  auth.
SMTP server connection successful.
Sending to . . . 
Mail was not sent.

Reason: message.to is blank

### WARNING
The `disable_emails` site setting is currently set to non-staff.
Consider changing it to 'no' before performing any further troubleshooting.

以及

Sending to michael@example.com. . . 
Mail accepted by SMTP server.
Message-ID: dfaf1c88-aab6-474b-b50c-8c500afb6291@localhost

If you do not receive the message, check your SPAM folder
[...]

https://github.com/discourse/discourse/pull/13674

3 个赞