safety_mailer 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/safety_mailer/safety_mailer.rb +4 -4
- data/lib/safety_mailer/version.rb +3 -0
- data/lib/safety_mailer.rb +1 -0
- metadata +6 -5
@@ -1,10 +1,10 @@
|
|
1
1
|
module SafetyMailer
|
2
2
|
class Carrier
|
3
|
-
attr_accessor :
|
3
|
+
attr_accessor :matchers, :settings
|
4
4
|
def initialize(params = {})
|
5
|
-
self.
|
5
|
+
self.matchers = params[:allowed_matchers] || []
|
6
|
+
self.settings = params[:delivery_method_settings] || {}
|
6
7
|
delivery_method = params[:delivery_method] || :smtp
|
7
|
-
settings = params[:delivery_method_settings] || {}
|
8
8
|
@delivery_method = Mail::Configuration.instance.lookup_delivery_method(delivery_method).new(settings)
|
9
9
|
end
|
10
10
|
def log(msg)
|
@@ -12,7 +12,7 @@ module SafetyMailer
|
|
12
12
|
end
|
13
13
|
def deliver!(mail)
|
14
14
|
mail.to = mail.to.reject do |recipient|
|
15
|
-
if
|
15
|
+
if matchers.any?{ |m| recipient =~ m }
|
16
16
|
false
|
17
17
|
else
|
18
18
|
log "*** safety_mailer suppressing mail to #{recipient}"
|
data/lib/safety_mailer.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: safety_mailer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Bill Kirtley
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2013-05-03 00:00:00 Z
|
19
19
|
dependencies: []
|
20
20
|
|
21
21
|
description: Specify a domain (or set of domains, or magic word in email address) email is allowed to go to, and email to all other domains is silently dropped. Useful for testing and staging environments.
|
@@ -29,6 +29,7 @@ extra_rdoc_files: []
|
|
29
29
|
files:
|
30
30
|
- lib/safety_mailer/railtie.rb
|
31
31
|
- lib/safety_mailer/safety_mailer.rb
|
32
|
+
- lib/safety_mailer/version.rb
|
32
33
|
- lib/safety_mailer.rb
|
33
34
|
- README.rdoc
|
34
35
|
homepage: http://github.com/cluesque/safety_opener
|
@@ -60,7 +61,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
60
61
|
requirements: []
|
61
62
|
|
62
63
|
rubyforge_project:
|
63
|
-
rubygems_version: 1.8.
|
64
|
+
rubygems_version: 1.8.24
|
64
65
|
signing_key:
|
65
66
|
specification_version: 3
|
66
67
|
summary: Restrict email sent by your application to only approved domains or accounts.
|