How can I do disable email delivery in development mode?

Is it any way to do disable email delivery in development mode?

Kind regards.

On 23 June 2014 10:41, Jaimin P. [email protected] wrote:

Is it any way to do disable email delivery in development mode?

You can test which environment is currently running and not send the
email in development.
See http://apidock.com/rails/Rails/env/class

Colin

On 23 June 2014 10:41, Jaimin P. [email protected] wrote:
You can test which environment is currently running and not send the
email in development.
See env (Rails) - APIdock

Is their any way to add code in development.rb file and i can disable
email delivery?

Hi,

development.rb is environment specific file. It wont work when you run
application in production mode. So if you want to have access to single
file which you want to run in all the modes, better have the mailer code
in
environment.rb / application.rb file with environment conditions as said
in
previous mail.

development.rb is environment specific file. It wont work when you run
application in production mode. So if you want to have access to single
file which you want to run in all the modes, better have the mailer code
in
environment.rb / application.rb file with environment conditions as said
in
previous mail.

Thank you.

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

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.

I am looking for this type of answer. Thank you very much.

Kind regards.

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?

I use GitHub - pboling/sanitize_email: An Email Condom for your Ruby Server to force all emails to
be sent to one pre-defined email address.

Just do in development.rb config file:

config.action_mailer.perform_deliveries = false

On Monday, June 23, 2014 4:41:54 AM UTC-5, Ruby-Forum.com User wrote:

Is it any way to do disable email delivery in development mode?

Kind regards.


Posted via http://www.ruby-forum.com/.

Take a look at this Railscast

I recommend using the letter opener gem. it’s fantastic for development -
check it out: