Testing SharePoint 2010 Email Receivers - Part One
If you have ever worked with SharePoint development, you may have run into a situation where it becomes necessary to test the functionality of a custom email receiver event handler on a document library. This blog will not go into detail on how to create the library programmatically (Andy Burns has a good post on that here), instead we will focus on the infrastructure necessary for testing the event handler on a development server.
There are two main components that need to be present in your SharePoint development environment in order to test an email event handler: a component to store and send the email (SMTP), and a way to retrieve those emails (POP3, IMAP, etc.). These can be structured in complex ways across networks, but since this is a development environment it would be simpler to include everything on the same server. The following steps apply directly to Windows Server 2008 R2, but should be generic enough to be used for other configurations.
Setting up SMTP on a Windows Server is a fairly straightforward process since it is already included as a feature. It is not installed by default though, so if you have not set it up, you will have to take the time to install the feature. Microsoft has information on setting up SMTP here. The main point to pay attention to is that configuration is done through the IIS 6.0 console. After SMTP is installed with the default configuration, you will need to add a domain alias for the machine and a relay restriction which points to the local IP of the machine.
Once you have properly configured SMTP, the next step is setting up the other end of an email configuration. For simplicity and ease, this walk-through will use a free, third-party POP3 service. While POP3 was removed from Windows server and is not the best for an enterprise email system, it is simple to set up and will accomplish everything that needs to be done for testing email integration on a SharePoint development server. Visendo's POP3 software is a good candidate for a development machine; you can find the binaries and documentation on their website here.
After setting up SMTP and POP3 on the server, you will need an email client to be able to send and receive emails that will flow through SharePoint. Windows Mail has replaced Outlook Express and is easy to set up with this single server email configuration. Download and install from Microsoft here. Configure a new account in Windows Mail using the domain alias and administrator account that were set when installing the SMTP and POP3 services. The incoming and outgoing servers will simply be 127.0.0.1 since everything resides on the same machine. Once the account is set up, test it by sending an email and syncing the mailbox. It can take a few minutes to go through everything, but once an email goes out and comes into the mailbox, the server will be ready for testing.
This covers the initial part of testing email event receivers for SharePoint development machines. In Part Two of this series, we will look at utilizing some development tools to catch and debug emails as they are sent to and from SharePoint email enabled libraries. Stay tuned!
Learn more about DMC's SharePoint Consulting Services.
There are currently no comments, be the first to post one.