Sha256: 6c52cbc873f77e82e3cf1376c1f882fcabf0ad5145daeeef8f16a036cb808248
Contents?: true
Size: 941 Bytes
Versions: 2
Compression:
Stored size: 941 Bytes
Contents
require 'net/smtp' module Ring class SQA class Alarm class Email SERVER = 'localhost' def send msg @from = CFG.email.from @to = [CFG.email.to].flatten prefix = CFG.email.prefix? ? CFG.email.prefix : '' @subject = prefix + msg[:short] @body = msg[:long] send_email compose_email rescue => error Log.error "Email raised '#{error.class}' with message '#{error.message}'" end private def compose_email mail = [] mail << 'From: ' + @from mail << 'To: ' + @to.join(', ') mail << 'Subject: ' + @subject mail << 'List-Id: ' + 'ring-sqa <sqa.ring.nlnog.net>' mail << 'X-Mailer: ' + 'ring-sqa' mail << '' mail = mail.join("\n") mail+@body end def send_email email Net::SMTP.start('localhost') do |smtp| smtp.send_message email, @from, @to end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ring-sqa-0.0.23 | lib/ring/sqa/alarm/email.rb |
ring-sqa-0.0.22 | lib/ring/sqa/alarm/email.rb |