Need help on email

Hi,

I need to get emails from outlook.

I am doing this on Watir and ruby 1.9.3

I know this may be a wrong forum to talk about this, but i tried putting
queries on ruby-mail and watir forum but no body replied.

SO i tried using IMAP as well as ruby-mail.

WITH IMAP :

I written code like this :

outlook = WIN32OLE.new('Outlook.Application')
mapi = outlook.GetNameSpace('MAPI')
folders = mapi.Folders
new_messages = 0

#Getting email body of unred email
inbox = mapi.GetDefaultFolder(6)
inbox.Items.each do |message|
  puts message.body if message.Unread
      end

Now i want to mark this email which is unread now, to read. So that
next time i dont see thjis unread email.

Can we do this?

WITH mail gem :

I written code like this :

require ‘mail’
require ‘openssl’
Mail.defaults do
retriever_method :pop3, :address => “email.someemail.com”,
:port => 995,
:user_name => ‘domain/username’,
:password => ‘pwd’,
:enable_ssl => true
end
puts Mail.first

I have following questions :

  1.  How can I get all the unread emails ?
    
  2.  How can I get all links that are present inside emails?
    
  3.  Can I click Links present inside an email?
    
  4.  How can I get emails from a specific folder, if I have
    

subfolders?

If some one can help me, then that will be nice.

Bhavesh