The emails:test rake task should not report successful delivery when email is disabled

Similar to Email test area should warn if emails are disabled

This is misleading:

$ 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.

In this case, no email was sent since SiteSetting.disable_emails == "non-staff".

We should warn about this in the rake task. Do we want to:

  • add logic to Email::Sender#send that returns a value indicating whether the message was sent (e.g. sent, skipped, disabled, no_message)
  • or, add logic to the emails:test task that tests only for disable_emails?
1 Like

I think I had something to do with some of that code…

So the bit about the mail being accepted is a lie?

What I would most want is for the rake task to ignore the disable emails setting. If someone has access to the console then they should be able to send a test email.

1 Like

I agree; that’s a good point. It might be a good idea to send the email and report that email is disabled, just in case.

2 Likes