Class: ExceptionMailer::Mailer
- Inherits:
-
Object
- Object
- ExceptionMailer::Mailer
- Defined in:
- lib/exception_mailer/mailer.rb
Instance Attribute Summary collapse
-
#account ⇒ Object
readonly
Returns the value of attribute account.
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#server ⇒ Object
readonly
Returns the value of attribute server.
-
#subject ⇒ Object
readonly
Returns the value of attribute subject.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
Instance Method Summary collapse
-
#initialize(opts) ⇒ Mailer
constructor
A new instance of Mailer.
- #send_notification(exception) ⇒ Object
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.account @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
#account ⇒ Object (readonly)
Returns the value of attribute account.
5 6 7 |
# File 'lib/exception_mailer/mailer.rb', line 5 def account @account end |
#from ⇒ Object (readonly)
Returns the value of attribute from.
5 6 7 |
# File 'lib/exception_mailer/mailer.rb', line 5 def from @from end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
5 6 7 |
# File 'lib/exception_mailer/mailer.rb', line 5 def host @host end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
5 6 7 |
# File 'lib/exception_mailer/mailer.rb', line 5 def password @password end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
5 6 7 |
# File 'lib/exception_mailer/mailer.rb', line 5 def port @port end |
#server ⇒ Object (readonly)
Returns the value of attribute server.
5 6 7 |
# File 'lib/exception_mailer/mailer.rb', line 5 def server @server end |
#subject ⇒ Object (readonly)
Returns the value of attribute subject.
5 6 7 |
# File 'lib/exception_mailer/mailer.rb', line 5 def subject @subject end |
#to ⇒ Object (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.(build_msg(exception), from, *to) end end |