actionmailer_interceptor 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7260e94044417696b2016067a03a2a16fcd9654
|
4
|
+
data.tar.gz: 7581f4560fb73c694d1250250e6d668b65f0e177
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f0623ee5f5d2d382cb927b4c1013208df8badaddea38972bc3816b5ee2ff28b54682a7da54a996b1b936812aa0430a84685b1c30491ea25e54a625274f90995
|
7
|
+
data.tar.gz: bb2c1f075deac8d5303228fff6daad9a4cd936d28e8a64384d00d8caab26a28bbb88ec108cacf114dce18243b17022632e42589b6793b0af4df4b7f2e6304d21
|
data/README.md
CHANGED
@@ -10,9 +10,7 @@ in Gemfile:
|
|
10
10
|
in `config/initializers/actionmailer_interceptor.rb`:
|
11
11
|
|
12
12
|
```
|
13
|
-
|
14
|
-
|
15
|
-
if Rails.env.development? || Rails.env.staging?
|
16
|
-
ActionMailer::Base.register_interceptor(interceptor)
|
13
|
+
if ENV['redirection_email']
|
14
|
+
ActionMailer::Base.register_interceptor(ActionmailerInterceptor::MailInterceptor)
|
17
15
|
end
|
18
16
|
```
|
@@ -1,19 +1,21 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
module ActionmailerInterceptor
|
2
|
+
class MailInterceptor
|
3
|
+
attr_accessor :redirection_email
|
3
4
|
|
4
|
-
|
5
|
-
|
6
|
-
|
5
|
+
def initialize(options={})
|
6
|
+
@redirection_email = options[:redirection_email]
|
7
|
+
end
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
def self.delivering_email(message)
|
10
|
+
original_recipients = ' ['
|
11
|
+
[:to, :cc, :bcc].each do |field|
|
12
|
+
unless message.send(field).blank?
|
13
|
+
original_recipients << "#{field}: #{message.send(field).join(', ')}"
|
14
|
+
end
|
13
15
|
end
|
16
|
+
original_recipients << ']'
|
17
|
+
message.subject += original_recipients
|
18
|
+
message.to = @redirection_email
|
14
19
|
end
|
15
|
-
original_recipients << ']'
|
16
|
-
message.subject += original_recipients
|
17
|
-
message.to = @redirection_email
|
18
20
|
end
|
19
21
|
end
|
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: actionmailer_interceptor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marko Bošković
|
@@ -53,6 +53,7 @@ files:
|
|
53
53
|
- lib/actionmailer_interceptor.rb
|
54
54
|
- lib/actionmailer_interceptor/mail_interceptor.rb
|
55
55
|
- lib/actionmailer_interceptor/version.rb
|
56
|
+
- lib/generators/actionmailer_interceptor.rb
|
56
57
|
homepage: https://github.com/bosskovic/actionmailer_interceptor
|
57
58
|
licenses:
|
58
59
|
- MIT
|