Class: Sinatra::MailerPlugin::MailObject

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

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of MailObject.



7
8
9
10
# File 'lib/sinatra/mailer_plugin/mail_object.rb', line 7

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



14
15
16
17
18
# File 'lib/sinatra/mailer_plugin/mail_object.rb', line 14

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