box-o-sand/oldstuff/RubyFun/cookbook/014/05-minimalist.rb

19 lines
414 B
Ruby
Raw Normal View History

require 'rubygems'
require 'net/smtp'
require 'smtp-tls'
body = <<EOM
To: daniel.buch+rubytest@gmail.com
From: daniel.buch@gmail.com
Subject: minimalist message
AHOY
EOM
Net::SMTP.start('smtp.gmail.com', 587, 'gmail.com',
'daniel.buch@gmail.com', STDIN.readline, :login) do |smtp|
smtp.send_message(body, 'daniel.buch@gmail.com',
'daniel.buch+rubytest@gmail.com')
end