Skip to content

Commit

Permalink
use mail_interceptor
Browse files Browse the repository at this point in the history
  • Loading branch information
Neeraj Singh committed Jan 20, 2015
1 parent 52d3a9b commit fe87fa8
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ gem 'browser'
# haml as templating engine
gem 'haml-rails'

# intercepts outgoing emails in non-production environment
gem 'mail_interceptor'

# HTTP server for Rack applications for staginng and production
# See https://github.com/bigbinary/wheel/issues/43 for why unicorn is
# not used in development.
Expand Down
2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ GEM
kgio (2.9.2)
mail (2.6.3)
mime-types (>= 1.16, < 3)
mail_interceptor (0.0.1)
mime-types (2.4.3)
minitest (5.5.0)
minitest-reporters (1.0.8)
Expand Down Expand Up @@ -271,6 +272,7 @@ DEPENDENCIES
honeybadger
jbuilder (~> 1.2)
jquery-rails
mail_interceptor
minitest-reporters
pg
quiet_assets
Expand Down
5 changes: 5 additions & 0 deletions config/initializers/setup_email.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@
if Settings.mailer.delivery_method == :smtp
ActionMailer::Base.smtp_settings = Settings.mailer.smtp_settings
end

interceptor = MailInterceptor::Interceptor.new({ forward_emails_to: Settings.intercept_and_forward_emails_to,
deliver_emails_to: ["@company.com"],
subject_prefix: Settings.subject_prefix_for_outgoing_emails })
ActionMailer::Base.register_interceptor(interceptor)
3 changes: 2 additions & 1 deletion config/settings.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
common:

subject_prefix_for_outgoing_emails: WHEEL
secret_key_base: <%= ENV['SECRET_KEY_BASE'] %>
honeybadger_api_key: <%= ENV['HONEYBADGER_API_KEY'] %>
host: <%= ENV['APP_URL'] || ENV['HEROKU_URL'] || 'http://localhost:3000' %>
Expand Down Expand Up @@ -78,4 +79,4 @@ production:
enable_starttls_auto: true

support_email:
support@example.com
support@example.com

0 comments on commit fe87fa8

Please sign in to comment.