Email test from the console?


(Jay Pfaffman) #1

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.


(Mittineague) #2

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

Maybe development only and not production?


(Régis Hanol) #3

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 

(Jay Pfaffman) #4

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