Class: Snails::Mailer::TuktukBackend
- Defined in:
- lib/snails/mailer.rb
Instance Method Summary collapse
- #deliver(email, options = {}) ⇒ Object
- #deliver_many(emails, options = {}) ⇒ Object
-
#initialize(config = {}) ⇒ TuktukBackend
constructor
A new instance of TuktukBackend.
Constructor Details
#initialize(config = {}) ⇒ TuktukBackend
Returns a new instance of TuktukBackend.
170 171 172 173 174 175 176 177 178 179 180 181 |
# File 'lib/snails/mailer.rb', line 170 def initialize(config = {}) @debug = config[:debug] if key = config.dig(:dkim, :private_key) and File.exist?(key) config[:dkim][:private_key] = IO.read(key) elsif config[:dkim] puts "Private key for DKIM not found! Disabling..." config.delete(:dkim) end Tuktuk. = config end |
Instance Method Details
#deliver(email, options = {}) ⇒ Object
183 184 185 186 187 188 189 190 191 192 |
# File 'lib/snails/mailer.rb', line 183 def deliver(email, = {}) debug = @debug.nil? ? !Snails.env.production? : @debug # if debug isn't set, determine based on env resp, email = Tuktuk.deliver(email, debug: debug) if resp.is_a?(Tuktuk::Bounce) puts "[#{email[:to]}] Email bounced! [#{resp.code}] #{resp.}" end return resp, email end |
#deliver_many(emails, options = {}) ⇒ Object
194 195 196 |
# File 'lib/snails/mailer.rb', line 194 def deliver_many(emails, = {}) Tuktuk.deliver_many(emails, ) end |