smtp_tls version 1.0.1 has been released!
Provides SMTP STARTTLS support for Ruby 1.8.6 (built-in for 1.8.7+).
Simply
require ‘smtp_tls’ and use the Net::SMTP#enable_starttls method to talk
to
servers that use STARTTLS.
require ‘smtp_tls’
smtp = Net::SMTP.new address, port
smtp.enable_starttls
smtp.start Socket.gethostname, user, password, authentication do
|server|
server.send_message message, from, to
end
Changes:
1.0.1 / 2009-06-24
- 1 bug fix
- Fix indentation warning on 1.9
 
 
            
              
              
              
            
            
                
                
              
           
          
            
            
              
Provides SMTP STARTTLS support for Ruby 1.8.6 (built-in for 1.8.7+).
How can I install it for Ruby 1.8.7?
bash-3.2# gem install smtp_tls
    ERROR:  Error installing smtp_tls:
smtp_tls requires Ruby version ~> 1.8.6.0
bash-3.2# ruby -version
    ruby 1.8.7 (2009-06-08 patchlevel 173) [i686-linux]
             
            
              
              
              
            
            
                
                
              
           
          
            
            
              
you don’t need to. 1.8.7 and up already support smtp+tls.
demas@arch ~/sources/study/ruby $ cat smtp_test.rb
require ‘smtp_tls’
puts “hello”
demas@arch ~/sources/study/ruby $ ruby smtp_test.rb
smtp_test.rb:1:in `require’: no such file to load – smtp_tls
(LoadError)
from smtp_test.rb:1
             
            
              
              
              
            
            
                
                
              
           
          
            
            
              On Jun 25, 2009, at 02:05 , Andrey D. wrote:
bash-3.2# ruby -version
   ruby 1.8.7 (2009-06-08 patchlevel 173) [i686-linux]
you don’t need to. 1.8.7 and up already support smtp+tls.
             
            
              
              
              
            
            
                
                
              
           
          
            
            
              On Jun 25, 2009, at 06:20, Andrey D. wrote:
you don’t need to. 1.8.7 and up already support smtp+tls.
demas@arch ~/sources/study/ruby $ cat smtp_test.rb
require ‘smtp_tls’
puts “hello”
demas@arch ~/sources/study/ruby $ ruby smtp_test.rb
smtp_test.rb:1:in `require’: no such file to load – smtp_tls
(LoadError)
from smtp_test.rb:1
a) you didn’t require ‘rubygems’
b) you don’t need to require ‘smtp_tls’ on ruby 1.8.7+.  Just use
Net::SMTP’s TLS support like you normally would
c) Hint:
require ‘net/smtp’
begin
require ‘smtp_tls’
rescue LoadError
end
smtp = Net::SMTP.new address, port
smtp.enable_starttls
smtp.start Socket.gethostname, user, password, authentication do |
server|
server.send_message message, from, to
end
             
            
              
              
              
            
            
                
                
              
           
          
            
            
              On Sep 2, 2009, at 12:24, Marcelo David wrote:
server.send_message message, from, to
end
Hi,
I did the example and got this error:
uninitialized constant Net::SMTP::OpenSSL
the error occurs when run smtp.enable_starttls
Same hit?
Do you have openssl?
$ ruby -ropenssl -e ‘puts “I have OpenSSL!”’
I have OpenSSL!
             
            
              
              
              
            
            
                
                
              
           
          
            
            
              
require ‘net/smtp’
begin
require ‘smtp_tls’
rescue LoadError
end
smtp = Net::SMTP.new address, port
smtp.enable_starttls
smtp.start Socket.gethostname, user, password, authentication do |
server|
server.send_message message, from, to
end
Hi,
I did the example and got this error:
uninitialized constant Net::SMTP::OpenSSL
the error occurs when run smtp.enable_starttls
Same hit?
             
            
              
              
              
            
            
                
                
              
           
          
            
            
              Eric H. wrote:
On Sep 2, 2009, at 12:24, Marcelo David wrote:
server.send_message message, from, to
end
Hi,
I did the example and got this error:
uninitialized constant Net::SMTP::OpenSSL
the error occurs when run smtp.enable_starttls
Same hit?
Do you have openssl?
$ ruby -ropenssl -e ‘puts “I have OpenSSL!”’
I have OpenSSL!
Thanks Eric.
I got “no such file to load – openssl (LoadError)”
Then I used (on ubuntu 9.4):
sudo apt-get install libopenssl-ruby libssl0.9.8
And Not resolved.
I’m using ruby 1.9.1p0.
             
            
              
              
              
            
            
                
                
              
           
          
            
            
              Marcelo David wrote:
Eric H. wrote:
On Sep 2, 2009, at 12:24, Marcelo David wrote:
server.send_message message, from, to
end
Hi,
I did the example and got this error:
uninitialized constant Net::SMTP::OpenSSL
the error occurs when run smtp.enable_starttls
Same hit?
Do you have openssl?
$ ruby -ropenssl -e ‘puts “I have OpenSSL!”’
I have OpenSSL!
Thanks Eric.
I got “no such file to load – openssl (LoadError)”
Then I used (on ubuntu 9.4):
sudo apt-get install libopenssl-ruby libssl0.9.8
And Not resolved.
I’m using ruby 1.9.1p0.
Eric,
I removed ruby 1.9 and used apt-get to install 1.8.7 with libs:
$ sudo apt-get install ruby irb rdoc rake rubygems libopenssl-ruby1.8
libssl0.9.8
That works!!!
Thanks
             
            
              
              
              
            
            
                
                
              
           
          
            
            
              On Sep 3, 2009, at 04:33, Marcelo David wrote:
Eric,
I removed ruby 1.9 and used apt-get to install 1.8.7 with libs:
$ sudo apt-get install ruby irb rdoc rake rubygems libopenssl-ruby1.8
libssl0.9.8
You’re probably not using the smtp_tls gem then:
$ gem list -dr smtp_tls
*** REMOTE GEMS ***
smtp_tls (1.0.3)
Authors: Eric H., Kyle M.
Rubyforge: http://rubyforge.org/projects/seattlerb
Homepage: http://seattlerb.rubyforge.org/smtp_tls
 Provides SMTP STARTTLS support for Ruby 1.8.6 (built-in for 1.8.7+)
                                               ^^^^^^^^^^^^^^^^^^^^^
             
            
              
              
              
            
            
                
                
              
           
          
            
            
              Eric H. wrote:
On Sep 3, 2009, at 04:33, Marcelo David wrote:
Eric,
I removed ruby 1.9 and used apt-get to install 1.8.7 with libs:
$ sudo apt-get install ruby irb rdoc rake rubygems libopenssl-ruby1.8
libssl0.9.8
You’re probably not using the smtp_tls gem then:
$ gem list -dr smtp_tls
*** REMOTE GEMS ***
smtp_tls (1.0.3)
Authors: Eric H., Kyle M.
Rubyforge: http://rubyforge.org/projects/seattlerb
Homepage: http://seattlerb.rubyforge.org/smtp_tls
 Provides SMTP STARTTLS support for Ruby 1.8.6 (built-in for 1.8.7+)
                                               ^^^^^^^^^^^^^^^^^^^^^
Hi Eric,
Excuse me my poor english. I tried to say when I uninstall ruby 1.9 and
reinstalled using apt-get to ruby 1.8.7, the problem was resolved. Now
with ‘gem list -dr smtp_tls’ like you sugested, I have the message
above, than, thats all right.
Thank you very much.