1

I'm trying to prevent emails from being delivered so I can inspect the contents of ActionMailer::Base.deliveries for testing in a staging environment. I have config.action_mailer.delivery_method = :test in my environment settings but Rails is still attempting to deliver the emails and the deliveries array is empty. What am I doing wrong?

kid_drew
  • 3,857
  • 6
  • 28
  • 38

1 Answers1

0

I agree with the other commenter that the best way to prevent all deliveries is through the action_mailer config.

However, if you want an alternative approach that would allow you to redirect any mail, or halt delivery based on a dynamic set of conditions, etc., then I would encourage you to check out Mail Interceptors:

http://guides.rubyonrails.org/action_mailer_basics.html#intercepting-emails

Bryce
  • 2,802
  • 1
  • 21
  • 46