Skip to content

Instantly share code, notes, and snippets.

@ecylmz
Created December 13, 2011 08:54
Show Gist options
  • Save ecylmz/1471290 to your computer and use it in GitHub Desktop.
Save ecylmz/1471290 to your computer and use it in GitHub Desktop.
require 'tlsmail'
require 'time'
from = "[email protected]"
to = "[email protected]"
p = "password"
content = <<EOF
From: #{from}
To: #{to}
subject: TEST from ruby
Date: #{Time.now.rfc2822}
Hello world!
EOF
Net::SMTP.enable_tls(OpenSSL::SSL::VERIFY_NONE)
Net::SMTP.start('smtp.gmail.com', 587, 'gmail.com', from, p, :login) do |smtp|
smtp.send_message(content, from, to)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment