delivery_reroute 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2007 Joe Noon
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README ADDED
@@ -0,0 +1,14 @@
1
+ Delivery Reroute
2
+ ================
3
+
4
+ Contact: Joe Noon - joenoon[at]gmail.com
5
+
6
+ All emails will be sent to the address you specify instead of to the defined recipients.
7
+
8
+ Example config/development.rb configuration:
9
+
10
+ config.after_initialize do
11
+ ActionMailer::Base.delivery_method = :reroute # sets that you want to reroute all emails
12
+ ActionMailer::Base.delivery_reroute_method = :smtp # sets that you want to use your underlying smtp settings
13
+ ActionMailer::Base.delivery_reroute_to = 'joe@example.com' # sets the address that receives all emails
14
+ end
data/Rakefile ADDED
@@ -0,0 +1,13 @@
1
+ begin
2
+ require 'jeweler'
3
+ Jeweler::Tasks.new do |gemspec|
4
+ gemspec.name = "delivery_reroute"
5
+ gemspec.summary = "Delivery rerouting for ActionMailer"
6
+ gemspec.description = "Reroute ActionMailer emails to an configured email address instead of the specified recipients. Great for development."
7
+ gemspec.email = "joenoon@gmail.com"
8
+ gemspec.homepage = "http://github.com/joenoon/delivery_reroute"
9
+ gemspec.authors = ["Joe Noon"]
10
+ end
11
+ rescue LoadError
12
+ puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
13
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.0
@@ -0,0 +1,42 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{delivery_reroute}
8
+ s.version = "1.0.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Joe Noon"]
12
+ s.date = %q{2009-10-11}
13
+ s.description = %q{Reroute ActionMailer emails to an configured email address instead of the specified recipients. Great for development.}
14
+ s.email = %q{joenoon@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "README"
17
+ ]
18
+ s.files = [
19
+ "MIT-LICENSE",
20
+ "README",
21
+ "Rakefile",
22
+ "VERSION",
23
+ "delivery_reroute.gemspec",
24
+ "init.rb",
25
+ "lib/delivery_reroute.rb"
26
+ ]
27
+ s.homepage = %q{http://github.com/joenoon/delivery_reroute}
28
+ s.rdoc_options = ["--charset=UTF-8"]
29
+ s.require_paths = ["lib"]
30
+ s.rubygems_version = %q{1.3.5}
31
+ s.summary = %q{Delivery rerouting for ActionMailer}
32
+
33
+ if s.respond_to? :specification_version then
34
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
35
+ s.specification_version = 3
36
+
37
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
38
+ else
39
+ end
40
+ else
41
+ end
42
+ end
data/init.rb ADDED
@@ -0,0 +1 @@
1
+ require 'delivery_reroute'
@@ -0,0 +1,26 @@
1
+ module ActionMailer
2
+ class Base
3
+ cattr_accessor :delivery_reroute_to
4
+ cattr_accessor :delivery_reroute_method
5
+
6
+ private
7
+
8
+ def perform_delivery_reroute(mail)
9
+ if (@@delivery_reroute_to && @@delivery_reroute_method)
10
+ mail.subject += " [#{RAILS_ENV.upcase}, was to: #{mail.to.join(',')}"
11
+ mail.subject += "; cc: #{mail.cc.join(',')}" unless mail.cc.nil?
12
+ mail.subject += "; bcc: #{mail.bcc.join(',')}" unless mail.bcc.nil?
13
+ mail.subject += "]"
14
+
15
+ mail.to = quote_address_if_necessary(@@delivery_reroute_to, charset)
16
+ mail.cc = mail.bcc = nil
17
+ logger.info "Mail rerouted to: #{mail.to.join(',')}"
18
+ return __send__("perform_delivery_#{@@delivery_reroute_method.to_s}", mail)
19
+ else
20
+ logger.warn "Please define ActionMailer::Base.delivery_reroute_to and ActionMailer::Base.delivery_reroute_method"
21
+ perform_delivery_test(mail)
22
+ end
23
+ end
24
+
25
+ end
26
+ end
metadata ADDED
@@ -0,0 +1,61 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: delivery_reroute
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Joe Noon
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-10-11 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: Reroute ActionMailer emails to an configured email address instead of the specified recipients. Great for development.
17
+ email: joenoon@gmail.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - README
24
+ files:
25
+ - MIT-LICENSE
26
+ - README
27
+ - Rakefile
28
+ - VERSION
29
+ - delivery_reroute.gemspec
30
+ - init.rb
31
+ - lib/delivery_reroute.rb
32
+ has_rdoc: true
33
+ homepage: http://github.com/joenoon/delivery_reroute
34
+ licenses: []
35
+
36
+ post_install_message:
37
+ rdoc_options:
38
+ - --charset=UTF-8
39
+ require_paths:
40
+ - lib
41
+ required_ruby_version: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: "0"
46
+ version:
47
+ required_rubygems_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: "0"
52
+ version:
53
+ requirements: []
54
+
55
+ rubyforge_project:
56
+ rubygems_version: 1.3.5
57
+ signing_key:
58
+ specification_version: 3
59
+ summary: Delivery rerouting for ActionMailer
60
+ test_files: []
61
+