Project

mailsafe

0.01
No commit activity in last 3 years
No release in over 3 years
Safe emailing for Rails
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 0
>= 0
>= 0
 Project Readme

Code Climate Build Status

Mailsafe

Safe emailing for Rails. Prevents you from sending emails to real customers from non-production environments. You can choose to either re-route all emails to a single developer account or allow only recipients of your own domain.

Installation

Add this line to your application's Gemfile:

gem 'mailsafe'

And then execute:

$ bundle

Usage

You can re-route all emails to your developer email account by adding this your development.rb file

Mailsafe.setup do |config|
  config.override_receiver = "developer@devco.com"
end

The email subjects will be delivered to your account and prefixed with the original receiver in square brackets.

You can send emails to the intended recipients but only to a whitelist of receipient domains (e.g. helpful for a staging environment where you want to send emails to your company's and your client's domain)

Mailsafe.setup do |config|
  config.allowed_domain = "devco.com, clientco.com"
end

If you are running multiple environments with mailsafe it can help to know which environment an email came from. You can have mailsafe prefix the subject line with [environment name]

config.prefix_email_subject_with_rails_env = true

Caveat

In order to filter (as in not send) emails I had to monkey patch the Mail#deliver method. If this makes you feel uneasy, better try out a different solution.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request