From: Rohit Mehta Date: 2006-06-01T00:33:08+09:00 Subject: TMail question / ?error? Hi I am trying to write a Ruby program to test our antispam filter. So the first part of my strategy is to take a bunch of spam and a bunch of notspam messages which I've sorted into two mozilla-thunderbird mbox files and pump them into the spamfilter. However, I may be getting stuck with Ruby syntax. The following code works properly: require 'tmail' @loader = TMail::UNIXMbox.new('spamfile') @loader.each_port do |port| mail=TMail::Mail.new(port) do something with the mail end However the following fails: ro@atlas:/tmp$ irb irb(main):001:0> require 'tmail' => true irb(main):002:0> @loader = TMail::UNIXMbox.new('spamfile') => #, @closed=false, @real=#> irb(main):003:0> port = @loader.new_port => # irb(main):004:0> mail = TMail::Mail.new(port) Errno::ENOENT: No such file or directory - /tmp/ruby_tmail_8378_0.860064296748723/1 from /usr/local/stow/ruby-1.8.4/lib/ruby/site_ruby/1.8/tmail/port.rb:62:in `initialize' from /usr/local/stow/ruby-1.8.4/lib/ruby/site_ruby/1.8/tmail/port.rb:62:in `ropen' from /usr/local/stow/ruby-1.8.4/lib/ruby/site_ruby/1.8/tmail/mail.rb:42:in `initialize' from (irb):4 I noticed that when the @loader.each_port do loop starts it creates a directory full of files in /tmp, and each appears to be a file containing a single message from my mbox file, but @loader.new_port does not do this. Is new_port not working properly? (I'm looking at mailbox.rb, but I'm not sure that I understand what's going on) The reason I want to do things this way is because I want to create wrapper classes SpamSource and NotSpamSource so I can send a controlled percentage of spam to our gateway. I'd like to be able to do: a=rand(100) if (a