Sha256: d07711aa75b7d9644e0551cb81f0d239abb5504be064666e0ea8b3564f9cea30
Contents?: true
Size: 1.34 KB
Versions: 2
Compression:
Stored size: 1.34 KB
Contents
module Outbox module Clients class MailClient < Base defaults delivery_method: :smtp # Returns the configured delivery method. def delivery_method settings[:delivery_method] end # Returns the configured delivery method settings. This will also check # the Rails-style #{delivery_method}_settings key as well. # # client = Outbox::Clients::MailClient.new( # delivery_method: :sendmail, # delivery_method_settings: { location: '/usr/bin/sendmail' } # ) # client.delivery_method_settings #=> { location: '/usr/bin/sendmail' } # # client = Outbox::Clients::MailClient.new( # delivery_method: :sendmail, # sendmail_settings: { location: '/usr/bin/sendmail' } # ) # client.delivery_method_settings #=> { location: '/usr/bin/sendmail' } def delivery_method_settings ( settings[:delivery_method_settings] || settings[:"#{delivery_method}_settings"] || {} ) end def deliver(email) message = create_message_from_email(email) message.delivery_method(delivery_method, delivery_method_settings) message.deliver end private def create_message_from_email(email) email.message_object.dup end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
outbox-0.2.1 | lib/outbox/clients/mail_client.rb |
outbox-0.2.0 | lib/outbox/clients/mail_client.rb |