This is my best effort:
#!/usr/bin/env ruby
#ENCODING: UTF-8
require 'rubygems'
require 'net/smtp'
require 'mail'
TO = 'you@test.com'
FROM = 'me@test.com'
mail = Mail.new do
  from    FROM
  to      TO
  subject 'This is a test email'
  body    "Test\n\nNow is the time #{Time.now}\n"
end
Net::SMTP.start('localhost') do |smtp|
  smtp.send_message(mail.to_s, TO, FROM)
end
I hope it could save someone's time!
 
No comments:
Post a Comment