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 :
-
How can I get all the unread emails ?
-
How can I get all links that are present inside emails?
-
Can I click Links present inside an email?
-
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