Class: Sunabamail::DeliveryMethod
- Inherits:
-
Object
- Object
- Sunabamail::DeliveryMethod
- Defined in:
- lib/sunabamail/delivery_method.rb
Instance Method Summary collapse
- #deliver!(mail) ⇒ Object
-
#initialize(options = {}) ⇒ DeliveryMethod
constructor
A new instance of DeliveryMethod.
Constructor Details
#initialize(options = {}) ⇒ DeliveryMethod
Returns a new instance of DeliveryMethod.
5 6 |
# File 'lib/sunabamail/delivery_method.rb', line 5 def initialize( = {}) end |
Instance Method Details
#deliver!(mail) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/sunabamail/delivery_method.rb', line 8 def deliver!(mail) subject = mail.subject created_at = mail.date || Time.zone.now updated_at = created_at addresses = %i[bcc cc from reply_to sender to].to_h { [ _1, mail[_1].to_s.presence ] } = Sunabamail::Message.new(**addresses, subject:, created_at:, updated_at:) .build_raw(encoded: mail.encoded) .save! end |