Top Level Namespace
Defined Under Namespace
Classes: String
Instance Method Summary collapse
Instance Method Details
#send_email(to, opts = {}) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/precis.rb', line 10 def send_email(to, opts = {}) require 'net/smtp' opts[:server] ||= 'localhost' opts[:from] ||= 'robot@localhost' opts[:from_alias] ||= 'The Git Summary Robot' opts[:subject] ||= "" opts[:body] ||= "" msg = <<END_OF_MESSAGE From: #{opts[:from_alias]} <#{opts[:from]}> To: <#{to}> MIME-Version: 1.0 Content-type: text/html; charset=UTF-8 Subject: #{opts[:subject]} #{opts[:body]} END_OF_MESSAGE Net::SMTP.start(opts[:server]) do |smtp| smtp. msg, opts[:from], to end end |