In this post, I describe how to use “IMAP Email Client” module in Orchard Gallery.

IMAP Email client is an easy-to-use module for receiving electronic mails from an Internet Message Access Protocol (IMAP) server. It is a wrapper around the open source implementation of IMAP protocol written by Torben Könke (https://github.com/smiley22/S22.Imap). The original library is under the MIT license, so as this module.

As it is clear from the name of protocol, it is an Application Layer Internet protocol that allows an e-mail client to access e-mail on a remote mail server. IMAP, unlike POP, specifically allows multiple clients simultaneously connected to the same mailbox, and through flags stored on the server, different clients accessing the same mailbox at the same or different times can detect state changes made by other clients. (read more here).

Using the module is very easy. The first thing is configuring the module. In order to do so, in the Orchard admin dashboard, in the Settings section, please click on “IMAP Email Client” page.

In the setting page, you must specify the address of server (host and port number), username and password. In case that your email server using SSL, you must tick it. You have the option to download the old emails by entering the field called “Download emails from ...minutes ago.. By saving the settings, the module starts downloading the emails. It checks the server every two minutes.

For each received message, the module fires a workflow event called “Email Received”. The Content of the event contains the original email message. It is up to you, how you want to use the event.

I tested the module with gmail, yahoo, Microsoft and OrchardCollaboration mail server and it works nice. Thanks to Torben Könke!