Email test from the console?

Is there a way to initiate an email test from the Rails console? For a zillion reasons I would love to be able to send a test email without having to create an account. I’ve looked in config/routes.rb and grepped all over the models, controllers, and lib.

I haven’t tried it, but AFAIK it can be done with

Maybe development only and not production?

If sidekiq is running, you can do exactly what the Admin Email Controller does

Jobs::TestEmail.new.execute(to_address: "foo@bar.com")

If sidekiq isn’t running, then you need to go deeper and do what the Test Email Job does

Email::Sender.new(TestMailer.send_test("foo@bar.com"), :test_message).send 
6 Likes

Thanks, @zogstrip! I guess my greps of the controllers were too specific.

4 Likes