Skip to content

wireframe/email_prefixer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Coverage Status Code Climate

EmailPrefixer

Automatically prefix all delivered emails with the application name and Rails environment. A helpful configuration for setting up email filters for non-production emails and ensuring consistency across all email deliveries.

Examples:

[MyApp] Forgot Password
[MyApp STAGING] Forgot Password

Based upon this coderwall protip

Installation

Add this line to your application's Gemfile:

gem 'email_prefixer'

Configuration

All EmailPrefixer configuration can be customized using a standard Rails config initializer.

# config/initializers/email_prefixer.rb
EmailPrefixer.configure do |config|
  # custom configuration goes here
end

Some of the more common configuration options are listed here. See the source code and test suite for a full list of options.

application_name - Customize Application Name

The application name is automatically inferred from the Rails application class name and can be overridden via the application_name setting.

Example:

# config/initializers/email_prefixer.rb
EmailPrefixer.configure do |config|
  config.application_name = 'MyApp'
end

stage_name - Customize Environment Stage Name

The application environment/stage name is automatically inferred from the running Rails.env and it can be overridden via the stage_name setting.

Example:

# config/initializers/email_prefixer.rb
EmailPrefixer.configure do |config|
  config.stage_name = 'demo'
end

builder - Override the prefix format

Want to override the default format for the email prefix? Assign a custom proc to the builder setting like so:

Example:

# config/initializers/email_prefixer.rb
EmailPrefixer.configure do |config|
  config.builder = lambda do
    '**MyEmailPrefix** '
  end
end

Contributing

  1. Fork it ( https://github.com/wireframe/email_prefixer/fork )
  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 a new Pull Request