Class: ExceptionMailer::Mailer

Inherits:
Object
  • Object
show all
Defined in:
lib/exception_mailer/mailer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Mailer

Returns a new instance of Mailer.



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/exception_mailer/mailer.rb', line 7

def initialize(opts)
  @host        = opts[:host]        || ExceptionMailer.host
  @server      = opts[:server]      || ExceptionMailer.server
  @port        = opts[:port]        || ExceptionMailer.port
  @account     = opts[:account]     || ExceptionMailer.
  @password    = opts[:password]    || ExceptionMailer.password
  @auth_method = opts[:auth_method] || ExceptionMailer.auth_method
  @to          = opts[:to]          || ExceptionMailer.to
  @from        = opts[:from]        || ExceptionMailer.from
  @subject     = opts[:subject]     || ExceptionMailer.subject

  @to = [ @to ] unless @to.kind_of? Array
end

Instance Attribute Details

#accountObject (readonly)

Returns the value of attribute account.



5
6
7
# File 'lib/exception_mailer/mailer.rb', line 5

def 
  @account
end

#fromObject (readonly)

Returns the value of attribute from.



5
6
7
# File 'lib/exception_mailer/mailer.rb', line 5

def from
  @from
end

#hostObject (readonly)

Returns the value of attribute host.



5
6
7
# File 'lib/exception_mailer/mailer.rb', line 5

def host
  @host
end

#passwordObject (readonly)

Returns the value of attribute password.



5
6
7
# File 'lib/exception_mailer/mailer.rb', line 5

def password
  @password
end

#portObject (readonly)

Returns the value of attribute port.



5
6
7
# File 'lib/exception_mailer/mailer.rb', line 5

def port
  @port
end

#serverObject (readonly)

Returns the value of attribute server.



5
6
7
# File 'lib/exception_mailer/mailer.rb', line 5

def server
  @server
end

#subjectObject (readonly)

Returns the value of attribute subject.



5
6
7
# File 'lib/exception_mailer/mailer.rb', line 5

def subject
  @subject
end

#toObject (readonly)

Returns the value of attribute to.



5
6
7
# File 'lib/exception_mailer/mailer.rb', line 5

def to
  @to
end

Instance Method Details

#send_notification(exception) ⇒ Object



21
22
23
24
25
# File 'lib/exception_mailer/mailer.rb', line 21

def send_notification(exception)
  Net::SMTP.start(*start_args) do |smtp|
    smtp.send_message(build_msg(exception), from, *to)
  end
end