0.0
No release in over a year
Intercepts and forwards emails.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

Mail Defender

This gem intercepts and forwards email to a forwarding address in a non-production environment. This is to ensure that in staging or in development by mistake we do not deliver emails to the real people. However we need to test emails time to time.

Usage

# There is no need to include this gem for production or for test environment
gem 'mail_defender', group: [:development, :staging]
# config/initializers/mail_defender.rb
if Rails.env.development? || Rails.env.staging?
  ActiveSupport.on_load(:action_mailer) do
    register_interceptor(MailDefender.new(
      forward_emails_to: 'intercepted_emails@domain.com',
      deliver_emails_to: [/@wheel\.com$/, 'tester@allowed.test']
    ))
  end
end

Sending mail to xxx@deny.test with the above settings will actually send mail to "Orig to: xxx@deny.test" <intercepted_emails@domain.com>.

License

The gem is available as open source under the terms of the MIT License.

Thanks

Inspired by mail_interceptor.