views:

41

answers:

2

I'm on Heroku, and emails don't get sent out in development, but are properly being sent in production. I'd like to run a seperate staging instance on Heroku, but don't want emails being sent out (just to a log).

+1  A: 

put this in your environment.rb file

config.action_mailer.delivery_method = :test

It should stop sending mail to the mail server, I think there is a :log option, but I have not tried it out.

Chiwai Chan
You probably want it in a separate `environments/staging.rb` file, though, and not in the global `environment.rb` file.
rspeicher
+1  A: 

This line in test.rb tells ActionMailer not to deliver emails:

config.action_mailer.delivery_method = :test

Instead, they are accumulated in the ActionMailer::Base.deliveries array.

You'll need to set up a staging environment for your application and configure Heroku to use that environment on your staging instance.

Alex - Aotea Studios