$ rake 'emails:test[michael@example.com]'
Testing sending to michael@example.com using mx-out:25.
SMTP server connection successful.
Sending to michael@example.com. . .
Mail accepted by SMTP server.
If you do not receive the message, check your SPAM folder
or test again using a service like http://www.mail-tester.com/.
If the message is not delivered it is not a problem with Discourse.
Check the SMTP server logs to see why it failed to deliver the message.
이 경우 SiteSetting.disable_emails == "non-staff"였기 때문에 이메일이 전송되지 않았습니다.
이 rake 작업에서 이에 대한 경고를 표시해야 합니다. 다음 중 어떤 방식을 취할까요?
Email::Sender#send에 메시지가 전송되었는지를 나타내는 값을 반환하는 로직을 추가합니다 (예: sent, skipped, disabled, no_message)
또는 emails:test 작업에 disable_emails만 테스트하는 로직을 추가합니다
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
[...]