Class: SinatraMore::MailObject

Inherits:
Object
  • Object
show all
Defined in:
lib/sinatra_more/mailer_plugin/mail_object.rb

Instance Method Summary collapse

Constructor Details

#initialize(mail_attributes = {}, smtp_settings = {}) ⇒ MailObject



6
7
8
9
# File 'lib/sinatra_more/mailer_plugin/mail_object.rb', line 6

def initialize(mail_attributes={}, smtp_settings={})
  @mail_attributes = mail_attributes.dup
  @smtp_settings = smtp_settings.dup if smtp_settings.present?
end

Instance Method Details

#deliverObject

Constructs the delivery attributes for the message and then sends the mail



13
14
15
16
17
# File 'lib/sinatra_more/mailer_plugin/mail_object.rb', line 13

def deliver
  @mail_attributes.reverse_merge!(:via => self.delivery_method.to_sym)
  @mail_attributes.reverse_merge!(:smtp => @smtp_settings) if using_smtp?
  self.send_mail(@mail_attributes)
end