Skip to content

Intercept recipients when delivering email with the Mail gem.

License

Notifications You must be signed in to change notification settings

bobbus/recipient_interceptor

This branch is 1 commit ahead of, 27 commits behind croaky/recipient_interceptor:main.

Folders and files

NameName
Last commit message
Last commit date
Mar 6, 2014
Mar 6, 2014
Jan 28, 2013
Aug 1, 2013
Jan 28, 2013
Aug 1, 2013
Feb 24, 2013
Mar 6, 2014
Jan 28, 2013
Aug 1, 2013

Repository files navigation

RecipientInterceptor

Build Status Code Quality

Never accidentally send emails to real people from your staging environment.

Rails example

Send all staging emails to a group email address without accidentally emailing users with active email addresses in the database.

In Gemfile:

gem 'recipient_interceptor'

In config/environments/staging.rb:

Mail.register_interceptor RecipientInterceptor.new(ENV['EMAIL_RECIPIENTS'])

From the command line:

heroku config:add EMAIL_RECIPIENTS="[email protected]" --remote staging

Options

Optionally prefix the subject line:

Mail.register_interceptor RecipientInterceptor.new(
  ENV['EMAIL_RECIPIENTS'],
  subject_prefix: '[STAGING]'
)

Optionally intercept emails :

Mail.register_interceptor RecipientInterceptor.new(
  ENV['EMAIL_RECIPIENTS'],
  condition: lambda { |message| message.subject =~ /Error/ } # if the condition proc return true the email is intercepted
)

Credits

RecipientInterceptor is maintained by Dan Croak and contributors like you.

License

RecipientInterceptor is © 2013 Dan Croak. It is free software, and may be redistributed under the terms specified in the LICENSE file.

About

Intercept recipients when delivering email with the Mail gem.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%