From: William Sobel Date: 2001-12-29T07:06:25+09:00 Subject: [ruby-talk:29591] Re: New Rubygarden poll "Mark Hahn" writes: > Thanks. > > Any way to do this incrementally as mail comes in? > I can not think of an easy way to do this. I looked through the CDO docs and could not find anything mentioning a callback when mail arrives. This is not to say one does not exist in one of the other MAPI libraries. - Will With some cleanup... require 'win32ole' # Open a MAPI session session = WIN32OLE.new('Mapi.session') session.logon('William Sobel') # Get the INBOX loop do messages = session.inbox.messages messages.each do |m| if m.subject =~ /(\[ruby-talk:[0-9]+\] )(.+)/o # No reference number # m.subject = $2 # Reference number at end: subject = "#{$2} #{$1}" m.update end end messages = nil sleep(2) end