0.0
No commit activity in last 3 years
No release in over 3 years
Implements an email interceptor which, when registered with the Mail gem, munges all "To:" email address to @eyepaste.com addresses. Especially helpful in dev or staging environments when you don't want emails delivered to actual addresses, but you may want to verify actual delivery.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.0

Runtime

~> 2.4
 Project Readme

eyepaste-mail

Description

eyepaste-mail is a ruby gem that implements a "mail interceptor" as specified by the popular Mail gem.

After registering the eyepaste-mail interceptor with the Mail gem, any emails sent with Mail are inspected before delivery and the "to" addresses are munged in the following way:

inbox@example.com -> inbox_example.com@eyepaste.com

After delivery, the above email would be available at:

http://www.eyepaste.com/inbox/inbox_example.com@eyepaste.com

And as RSS at:

http://www.eyepaste.com/inbox/inbox_example.com@eyepaste.com.rss

Whitelisting

By default, the eyepaste-mail interceptor munges all addresses. To allow some addresses to pass through unaltered, you can define a whitelist in the following ways:

# pass a regexp
Eyepaste::Mail::Interceptor.set_white_list /.+?@example.com/

# pass an array of regexps
Eyepaste::Mail::Interceptor.set_white_list [/.+?@example.com/, /^testing_.+?@example.com/]

# pass a block, it will be called every time a message is examined and munged
Eyepaste::Mail::Interceptor.set_white_list do
  # must return a regexp object or array of regexp objects
end

Registering The Interceptor

To register the interceptor with the Mail gem, call:

# optionally define a white_list:
Eyepaste::Mail::Interceptor.set_white_list /.+?@example.com/

# register with Mail
Mail.register_interceptor(Eyepaste::Mail::Interceptor)

Rails 3.2

Make sure eyepaste-mail is required by your Gemfile and you have then run bundle install

To only munge emails in a particular environment, you can place the following in an environment file. For development, place in config/environments/development.rb:

# optionally define a white_list:
Eyepaste::Mail::Interceptor.set_white_list /.+?@example.com/

# register with ActionMailer::Base (which wraps the call to Mail.register_interceptor)
ActionMailer::Base.register_interceptor(Eyepaste::Mail::Interceptor)

License

eyepaste-email is licensed under the MIT license:

Copyright (c) 2012. Jon Moniaci.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.