Hi Folks,
Hope everyone is fine and doing good. In this article of mine, I am going to narrate, how you can fetch Emails from your Microsoft Outlook account. I am only going to cover ‘Inbox‘ here. However, the scope of library (Gem) is very vast and you can customize this as per your need.
PREREQUISITE:
- Ruby
- ViewPoint Gem:
gem install viewpoint
For Debugging, I am using viewpoint/logging/config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'viewpoint' # Library for MS Outlook | |
require 'viewpoint/logging/config' # For Debugging | |
include Viewpoint::EWS | |
endpoint = 'YOUR MS EXACHANGE URL COMES HERE' # E.g. https://OUTLOOKSERVER_URL/ews/exchange.asmx | |
user = 'USERNAME' | |
pass = 'PASSWORD' | |
cli = Viewpoint::EWSClient.new endpoint, user, pass | |
folders = cli.folders | |
p folders[0].inspect | |
inbox = cli.get_folder_by_name 'Inbox' | |
items = inbox.items | |
p items[0].body.inspect | |
p items.count |
Hope this helps someone! Keep in touch and Happy Coding 🙂
Puneet