Poetry of Programming

Its about Ruby on Rails – Kiran Soumya

By

Release of Rockdove

Announcing the stable release of my gem Rockdove, version 0.3.1.

So what’s the noise about Rockdove ?

Rockdove is for those applications with a requirement to poll and process every incoming mail from Microsoft EWS 1.0 Mail Server !

It doesn’t just fly away blindly with the mail but parses each mail item for the actual content by stripping off replied or forwarded content. In most of the cases, strips off the signatures too if specified under proper convention with two dashes on top.

Rockdove is installed on our Production Rails App used by around 30k users triggering around 700 mails per day initially and the count seems to be increasing day by day with a number of 100’s…! Its proven to be well tested and stable.

The setting up of this gem is damn easy and pretty clear on github. If there are any queries on this, you can always drop a comment on this blog or raise a issue on github.

I would like to share some use-cases implemented in our Rails App (a enterprise social networking portal), using rockdove:

UseCase 1: Post via Email

Whenever a user emails to our mail server, mail@ewsdomain.com, the scenario is to create a new post in our social networking rails app. Rockdove fetches the mail item, strips off the signature and share the details of the sender and the mail content to our Model which does the App business logic of finding the sender under user list and posting the content under his/her name on the portal. If the sender email doesn’t exist and is not registered, we register those users automatically via email that matches our ewsdomain.com.

Example:

Rockdove::Config.configure do |config|

config.ews_url ‘https://mail.ewsdomain.com/ews/exchange.asmx’

config.ews_username ‘username’

config.ews_password ‘password’

…………………………

end

Rockdove::CollectMail.watch do |rockdove_parsed_mails|
…………………………
rockdove_parsed_mails.each do |email|

# Operation on your rails app Model, ex. Blog
Blog.post_thru(email)
end
…………………………
end

#  Rockdove Accessors one can play with email, ex. email.subject, email.body,

:subject, :body, :has_attachments?, :attachments, :to_recipients, cc_recipients, :date_time_created, :date_time_sent, :from

UseCase 2: Comment to a Post via Email

In a scenario of thread of discussions and users receiving couple of notifications on the post, the user can simply reply to a notification via email and get his mail content posted as a comment/reply to the discussion. Rockdove fetches the mail, pulls in the main content and strips off the previous post replied upon (if the email contains the forwarded content, it will be stripped off too). The content is always retrieved in the text format (supporting markdown syntax).

UseCase 3: Post to a particular User-Group

User can post to group with subject containing the group-name in square brackets ex: [My Community]. Rockdove passes the content of the subject as it is to your Rails app for further processing.

UseCase 4: Email Attachments

Rockdove supports email attachments and saves them to a file based on the path specified by the model in your rails app.

rockdove_email.save_to_file(email_attachment, “#{Rails.root}/assets/images”, filename)

# above code can be refactored as per your app requirements

UseCase 5: Ignore Senders

You can provide Rockdove to ignore mails from a group of sender’s addresses. Rockdove will ignore and even delete those mails from your inbox. ex: postmaster@ewsdomain.com

Rockdove::Config.configure do |config|

…………………………

config.ews_ignore_mails [“postmaster@ewsdomain.com”]

end

 

UseCase 6: Archive Mails that are processed

You can specify Rockdove whether these mails have to be archived on a different folder after processing them or delete them from your inbox.

Rockdove::Config.configure do |config|

…………………………

config.ews_folder ‘Inbox’

config.ews_archive_folder ‘Archive’

end

UseCase 7: Handling OOO and Mail Delivery failures

Your rails app need not worry about how to handle the OOO and delivery failure emails. Rockdove takes care of automatically collecting and deleting those mails even before passing them to your rails app. Whistles to this feature on Rockdove as it has saved a storm of automated out of office mails in the form of posts and comments in our rails app.

One Response to Release of Rockdove

  1. kiran says:

    Code quality metrics for Rockdove: https://codeclimate.com/github/kiranh/rockdove via @codeclimate

Leave a Reply to kiran Cancel reply

Your email address will not be published. Required fields are marked *