On Sat, Jan 21, 2012 at 10:11:08PM -0800, Jeremy Evans wrote: > On 01/21 11:18, Lawrence Teo wrote: > > According to the RubyMail NEWS file at > > https://github.com/matta/rubymail/blob/master/NEWS , this library is > > supposed to be usable with Ruby 1.9. However, when used with Ruby 1.9, > > it breaks one of my scripts that uses Net::SMTP to send a message > > created using RubyMail. > > > > A modified snippet of the test script is as follows, where if you run > > it with Ruby 1.9, you will get a NoMethodError exception. > > > > [BEGIN] > > #! /usr/local/bin/ruby19 > > > > require 'rubygems' > > require 'rmail' > > require 'net/smtp' > > > > msg = RMail::Message.new > > msg.header["To"] = "b...@example.com" > > msg.header["Subject"] = "Test subject" > > msg.body = "This is just a test" > > > > begin > > Net::SMTP.start("smtp.example.com", 25, "example.net") do |smtp| > > smtp.send_message msg, "al...@example.net", [ "b...@example.com" ] > > end > > rescue Exception => e > > puts "#{e.class} #{e}" > > end > > [END] > > > > This is because smtp.send_message causes RubyMail's message.rb to call > > String.each, but the String class in Ruby 1.9 no longer has the each() > > method. The following diff patches the message.rb to fix this issue. > > The fix is backwards compatible with Ruby 1.8, since Ruby 1.8's String > > does have an each() method. > > > > I have also changed my email address in the port's Makefile. > > > > If this looks ok, could a developer please commit this? > > I don't have an objection to this. However, the regression tests don't > appear to work in ruby 1.9 mode, even after modifying the Makefile to > get them to run. Can you look into this? Also, this library was last > updated in January 2008, which is probably why it isn't 1.9 compatible. > 1.9.1 wasn't released until January 2009, and wasn't library compatible > with 1.9, which is why ruby 1.9.3 still installs files into > /usr/local/lib/ruby/1.9.1. Even if you can get rmail working in 1.9 > mode, you may want to consider switching to the mail gem instead.
Jeremy, Thank you for looking at my diff. I'm aware of ruby-mail and have started using it for my new scripts; I just happen to have a few older scripts that are still using ruby-rmail that I have yet to port to ruby-mail. :) Given that this library has not been updated in such a long time and is unlikely to be updated in the future, I wonder if it should be removed from the ports tree instead of attempting to fix it any further. I'm pretty sure I'm the only user of it anyway. :) Please let me know what you think. Thanks, Lawrence