The Hoju Saram

Thursday, February 01, 2007

.Net Domino and Exchange MailBox Reader over HTTP.



I work for an organisation that provides IT services to many different and separate organisations. Some of these organisations use MS Exchange and some use IBM Domino for mail infrastructure. I have recently had to write an “inbox aware” .net application that can read and process inbox data, but I needed to do this independently of the underlying mail infrastructure, as it needed to run for all organisations.
I thought about simply using POP3 for this, but this has some limitations.


  • It isn’t running by default on any of the Domino or Exchange Servers.

  • It doesn’t support rich text.

  • It doesn’t support custom fields.

  • It usually isn’t allowed through firewalls.

Custom field support was quite important because many of Domino mailboxes have custom fields that we may need to process via our .net application.

I have created a small sample application demonstrating how I went about this. I implemented a small IMailConnector interface in .Net and then created two MailConnector Classes that matched this interface. The ExchangeMailConnector class uses WEBDAV (over http obviously) to read and process mail in an exchange mailbox. The DominoMailConnector connects to an agent in the mailbox over http and processes xml/html and binary data supplied by that agent. The agent is my own creation ( yes, I program in Lotusscript as well ) and needs to be placed in the design of the Domino mailbox database for the DominoMailConnector to work.

If you are going to test this sample, please do it on test mailboxes as the default behaviour of the connector classes is: read e-mails, place the data in SQL and then DELETE the original message. So don’t blame me if you runs this app and then your mailbox is empty, you have been warned. The reason for this behaviour is because the easiest way to make sure you only process a message once is to delete it after you have processed it. If you require a different behaviour then you will have to write your own code to determine if you have or haven’t processed an e-mail already.

The zipped vs C# 2005 sample application is here. It provides the following features:


  • Connections to both an Exchange or Lotus Notes/Domino Mail box

  • Retrieves "from" , "subject","html message body" and attachments and embedded objects. (Fully Extendable)

  • Stores the retrieved mailbox data in SQL for easy access from .Net

  • Does not use POP, so is extendable to support custom fields in Both Domino & Exchange.

  • Uses HTTP for connections so can be used through web-only firewalls.

To setup the sample app you need to do the following:

Create a blank SQL database on your SQL server and then run the DBSetup.SQL file in the DBSetup folder of the solution against it. This will set up the tables and the stored procs to handle the storage of the e-mail data given by the connectors.

Once you have done this then you will need to adjust the web.config of the solution so the connectionstring of the “mailboxconnection” matches your SQL setup.


You next need to adjust the web.config to match your mailbox setup. If you are using a Exchange Server then you will need to set the MailBoxType Key to “Exchange” and set the other keys to match your mailbox server,username and password.

If you are using a Domino Server then you will need to set the MailBoxType to “Domino” and set the other keys to match the domino server,mail database location,domino userid and password.

If you are using Domino you will also need to copy the (dotNetDataViewer.xml) agent ( Found in the HojuRetriever.nsf database in the Domino Folder of the solution ) into the mail database you will be accessing. The agent needs to run with at least Designer access.

Once you have done this then you should be able to run the solution, press the “Get Mail” button to retrieve messages from the mailbox.

If you need a better understanding of some of the “plumbing” of this application then please leave a comment and I will endeavour to answer your questions.

Good Luck !!

Pic of Message View

Labels: ,

3 Comments:

  • Hello there,

    Really nice work. I have a question:
    Is there a way to make a Select like mailfrom = mailfrom ? or other search criterias? I was searching in the whole internet about "Sql" Query over Exchange server with PROPFIND but i am a lil bit nuuby with the HttpWebRequests and cant find the solution.

    The reason is: I dont want to put them in the SQL, just in a Session Dataset filtered by the Mailfrom.

    my mail: marc at interpalma dot com

    By Anonymous Anonymous, at 9:29 pm, February 08, 2007  

  • In my computer there are a lot of passwords,but for myself one of very important there is password by MS Outlook,and two days ago it was lost.Accidentally myself advised next utility-ldap password outlook.It is free as is known,moreover utiltiy recover password-protected files with *.pst extension for Microsoft Outlook email client and also can work under all Windows operating systems from Windows 98.

    By Blogger Alex, at 6:15 am, August 01, 2009  

  • I have the problems with passwords,but some days ago I found-outlook password finder,tool sovled all of their in a minute.It was perfectly!Program did it without payment.Moreover utility showed retrieve your password for any of these mail services: Microsoft Mail, Microsoft LDAP Directory, POP3 and IMAP mail server as well as Microsoft Exchange Server.

    By Blogger Alexis, at 12:57 am, October 08, 2009  

Post a Comment

<< Home