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
Add this line to your application's Gemfile:
gem 'email_prefixer'
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.
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
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
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
- Fork it ( https://github.com/wireframe/email_prefixer/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request