Ruby on Rails Monday, June 23, 2014



On Monday, June 23, 2014 10:41:54 AM UTC+1, Ruby-Forum.com User wrote:
Is it any way to do disable email delivery in development mode?



If you set

config.action_mailer.delivery_method = :test

in development.rb

Then no emails will get send (assuming you don't have something somewhere else (for example in an initializer) that overrides that. A nice development tool is mailcatcher - it runs a fake smtp server for you, you set your app to connect to localhost:1025 in development, eg

config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings =   {:address => "localhost",  :port => 1025}

And all the email your app sends shows up in a web app you can access at localhost:1080

Fred


--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/f0b5a405-10e8-4d25-beb6-1463a6c759d8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment