Send email from Ruby program with TLS -
I'm trying to send an email from the Ruby program. The SMTP server is an Exchange 2007 server where I need to login to send email.
#! / Usr / bin / ruby requires 'rubygems' required 'net / smtp' msgstr = "test email." Smtp = Net :: SMTP.start ('smtp.server.com', 587, 'mail.server.com', 'username', 'password',: login) do | Smtp | Smtp.send_message msgstr, 'from@server.com', 'to@server.com' and
When I run it, I receive the following error.
I can not find anything in the referred TLS or STARTTLS order.
Edit: Download smtp-tls.rb; Code does not change much, but here I have to work.
#! / Usr / bin / ruby requires 'RubyGames' required 'Net / Smtp' requirement 'smtp-tls' msgstr = & lt; & Lt; From MESSAGE_END: I & lt; Me@test.com> To: You & lt; You@test.com> Subject: Email e-mail test body MESSAGE_END smtp = Net :: SMTP.start ('smtp.test.com', 587, 'test.com', 'username', 'passwd',: login) do | Smtp | Smtp.send_message msgstr, 'me@test.com', ['you@test.com'] and
Edit: Works with Ruby 1.8.6 < Net :: SMTP does not look like it supports startTLS encryption.
Net :: SMTP does not look like it supports startTLS encryption. I have got a project on Jitub, which has code to deal with it, though.
Comments
Post a Comment