Module: Reporting

Included in:
Inari::Commands
Defined in:
lib/inari/commands/reporting.rb

Instance Method Summary collapse

Instance Method Details

#email(options = {}) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/inari/commands/reporting.rb', line 2

def email(options={})
  from = "#{Etc.getlogin}@#{Socket.gethostname}"
  to = Inari::configuration.options[:email_to]
  message =<<MESSAGE
From: #{from}
To: #{to}
Subject: #{options[:subject]}

#{options[:body]}
MESSAGE

  Net::SMTP.start(Inari::configuration.options[:smtp_host]) do |smtp|
    smtp.send_message message, from, to
  end
end