module SanitizeEmail
Copyright © 2008-16 Peter H. Boling of RailsBling.com Released under the MIT license
Copyright © 2008-16 Peter H. Boling of RailsBling.com Released under the MIT license
Copyright © 2008-16 Peter H. Boling of RailsBling.com Released under the MIT license
Copyright © 2008-16 Peter H. Boling of RailsBling.com Released under the MIT license
Copyright © 2008-16 Peter H. Boling of RailsBling.com Released under the MIT license
Copyright © 2008-16 Peter H. Boling of RailsBling.com Released under the MIT license
Copyright © 2008-16 Peter H. Boling of RailsBling.com Released under the MIT license
Copyright © 2008-16 Peter H. Boling of RailsBling.com Released under the MIT license Note: the RspecMatchers
no longer use these methods. Instead they are composed matchers: See: www.relishapp.com/rspec/rspec-expectations/v/3-5/docs/composing-matchers
Copyright © 2008-16 Peter H. Boling of RailsBling.com Released under the MIT license
Constants
- VERSION
Attributes
Public Class Methods
# File lib/sanitize_email.rb, line 39 def self.[](key) return nil unless key.respond_to?(:to_sym) SanitizeEmail::Config.config[key.to_sym] end
# File lib/sanitize_email.rb, line 60 def self.activate?(message) proc = SanitizeEmail::Config.config[:activation_proc] proc.call(message) if proc.respond_to?(:call) end
# File lib/sanitize_email.rb, line 114 def self.janitor(options) raise MissingBlockParameter, 'SanitizeEmail.janitor must be called with a block' unless block_given? original = SanitizeEmail.force_sanitize SanitizeEmail.force_sanitize = options[:forcing] yield SanitizeEmail.force_sanitize = original end
NOTE: Deprecated method We have to actually define because we can't deprecate methods that are hooked up via method_missing
# File lib/sanitize_email.rb, line 56 def self.local_environments SanitizeEmail::Config.config[:local_environments] end
# File lib/sanitize_email.rb, line 44 def self.method_missing(name, *_args) SanitizeEmail[name] end
Regardless of the Config
settings of SanitizeEmail
you can do a local override to send sanitary email in any environment. You have access to all the same configuration options in the parameter hash as you can set in the actual SanitizeEmail.configure block.
SanitizeEmail.sanitary
({:sanitized_to => “boo@example.com”}) do
Mail.deliver do from "from@example.org" # Will actually be sent to the override addresses, not this one: to "to@example.org" reply_to "reply_to@example.org" subject "subject" end
end
# File lib/sanitize_email.rb, line 85 def self.sanitary(config_options = {}) raise MissingBlockParameter, 'SanitizeEmail.sanitary must be called with a block' unless block_given? janitor(:forcing => true) do original = SanitizeEmail::Config.config.dup SanitizeEmail::Config.config.merge!(config_options) yield SanitizeEmail::Config.config = original end end
NOTE: Deprecated method We have to actually define because we can't deprecate methods that are hooked up via method_missing
# File lib/sanitize_email.rb, line 50 def self.sanitized_recipients SanitizeEmail::Config.config[:sanitized_recipients] end
Regardless of the Config
settings of SanitizeEmail
you can do a local override to force unsanitary email in any environment.
Mail.deliver do from "from@example.org" to "to@example.org" reply_to "reply_to@example.org" subject "subject" end
end
# File lib/sanitize_email.rb, line 107 def self.unsanitary raise MissingBlockParameter, 'SanitizeEmail.unsanitary must be called with a block' unless block_given? janitor(:forcing => false) do yield end end