Class: RequestLogAnalyzer::Mailer
- Inherits:
-
Object
- Object
- RequestLogAnalyzer::Mailer
- Defined in:
- lib/request_log_analyzer/mailer.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#host ⇒ Object
Returns the value of attribute host.
-
#to ⇒ Object
Returns the value of attribute to.
Instance Method Summary collapse
- #<<(string) ⇒ Object
-
#initialize(to, host = 'localhost', options = {}) ⇒ Mailer
constructor
Initialize a mailer
to
to addresshost
the mailer hostoptions
Specific style options. - #mail ⇒ Object
- #puts(string) ⇒ Object
Constructor Details
#initialize(to, host = 'localhost', options = {}) ⇒ Mailer
Initialize a mailer to
to address host
the mailer host options
Specific style options
11 12 13 14 15 16 17 |
# File 'lib/request_log_analyzer/mailer.rb', line 11 def initialize(to, host = 'localhost', = {}) require 'net/smtp' @to = to @host = host @options = @data = [] end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
5 6 7 |
# File 'lib/request_log_analyzer/mailer.rb', line 5 def data @data end |
#host ⇒ Object
Returns the value of attribute host.
5 6 7 |
# File 'lib/request_log_analyzer/mailer.rb', line 5 def host @host end |
#to ⇒ Object
Returns the value of attribute to.
5 6 7 |
# File 'lib/request_log_analyzer/mailer.rb', line 5 def to @to end |
Instance Method Details
#<<(string) ⇒ Object
37 38 39 |
# File 'lib/request_log_analyzer/mailer.rb', line 37 def << string data << string end |
#mail ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/request_log_analyzer/mailer.rb', line 19 def mail from = @options[:from] || '[email protected]' from_alias = @options[:from_alias] || 'Request-log-analyzer reporter' to_alias = @options[:to_alias] || to subject = @options[:subjeect] || "Request log analyzer report - generated on #{Time.now.to_s}" msg = <<END_OF_MESSAGE From: #{from_alias} <#{from}> To: #{to_alias} <#{@to}> Subject: #{subject} #{@data.to_s} END_OF_MESSAGE Net::SMTP.start(@host) do |smtp| smtp. msg, from, to end end |
#puts(string) ⇒ Object
41 42 43 |
# File 'lib/request_log_analyzer/mailer.rb', line 41 def puts string data << string end |