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.

Ruby / 1.8 / should be released before /etc/rn/smtp.rb:921: /usr/lib/ruby/1.8/net/ 'Important' from smtp.rb: 739: /usr/lib/ruby/1.8/net/smtp.rb:725: to 'auth_login' in /usr/lib/ruby/1.8/net/smtp.rb:725:IN From 'do_start' with 'Authentication' from /usr/lib/ruby/1.8/net/smtp.rbitter66:in/usr/lib/ruby/1.8/net/smtp.rbitter25: 'Start' to Ruby from '/ usr / lib /' / 1.8 / net / smtp.rb: 463: In 'starting'

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

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -