How To poll out lotus notes(or any other mail server) emails into a Ruby App

A Utility to poll out emails from Mail server and bringing into a Ruby Application. Few steps to be used:

1. Get created your mailbox on lotus notes server with POP3 enabled.
2. Mailman gem
3. Script/task to poll the emails(to receive formatted emails and with attachments)
4. Some checks so that any email should not lost if any issue on server-side for the time being.
5. God gem(to monitor the script/task, to start/stop/restart).

STEP 1: Get created your mailbox server.
A mailbox server is what required for storing your email on notes database and then poll them in Ruby app.
It Should be POP3 enabled & ‘UTF-8’ enabled otherwise it could trouble with attachments & formats.

STEP 2: Add gem Mailman to your Gemfile
                Mailman is an incoming mail processing micro framework (with POP3 and Maildir support), that works with  Rails

                 gem ‘mailman’, :require =>  false
& run bundle install

STEP 3: Mailman Script
The script to read & fetch emails from notes database with attachments & proper format.
Lets create a rake task/script for the same.
Create a task execute_mailman.rake in lib/tasks
===============================================================================================

require “mailman” Continue Reading