Recently I needed to enable a SharePoint 2010 document library to accept incoming emails and then use the data from the body of the email to update list values.
It is really easy to configure SharePoint 2010 for incoming email and to enable a specific document library to receive emails.
You will find a few good tutorials on the web to help you achive this.
One of the very first things which you need to do is to install and configure a SMTP service on your SP2010 web front-end server. That is exactly where I ran into problems as my SP2010 web front end server is running on Windows 7.
Unfortunately Windows 7 does not ship with SMTP Service and almost all the documentation showing how to configure your SP2010 WFE for incoming mail focus on Windows 2008 server.
Many thanks to Wesley Bakker for the clear and helpful instructions which he posted at http://weblogs.asp.net/wesleybakker/archive/2010/08/09/configure-hmailserver-for-sharepoint.aspx
This short tutorial will illustrate how I managed to get my SharePoint 2010 incoming email configured on my Windows 7 web front-end server.
1. Download hMailServer from http://www.hmailserver.com/
2. Install hMailServer and create a new Administrator password when prompted.
3. Configure hMailServer in the following way:
(If I do not specify a setting to be changed then accept the default)
- After the install completed, add a new domain. You can use anything.
- In the new hMailServer domain create two new email accounts
- Expand Settings and click on SMTP. Set the ‘Local host name’ to your local machine name.
- Expand ‘Advanced’ and then expand ‘IP Ranges’ and click on ‘Localhost’. I changed the Name, Lower IP, Upper IP values and I removed the requirement for SMTP authentication.
- Because hMailServer does not have an email drop folder by default, you have to create a folder structure to use as a drop folder. I created the following folder structure to use as my drop folder: C:\Program Files (x86)\hMailServer\Data\JohanSPSDev.local\Dropfolder\
- Microsoft SMTP server adds header information to emails which hMailServer does not do, so if the information is missing SharePoint will not accept the emails into the library. So in order to prevent this you need to add a script to hMailServer to include the header information into the emails before there are dropped into the drop folder for SharePoint.
- This process is very clearly explained by Wesley Bakker in his post: http://weblogs.asp.net/wesleybakker/archive/2010/08/09/configure-hmailserver-for-sharepoint.aspx
- In hMailServer expand ‘Advanced’ and then click on ‘Scripts’.
- Enable Scripts and click on Show Scripts. Open the existing script file in notepad and add the following text.
- Ensure to change the drop folder path to your own configuration.
- After you made the changes save the file and close it.
- Back in hMailServer click on ‘Check syntax’ and then on ‘Reload scripts’.
4. Test your SMTP Service:
- Now our hMailServer should be up and running and we are ready to test whether we can send and receive email… because I also have a corporate email account and I have Outlook installed the easiest for me was to create a POP account in Outlook and point it to my new domain.
- The important thing here is to use an IP address of your local machine instead of using the word localhost or even your pc name. I tried my pc name as well as localhost but when I tested the account settings it kept failing… I only got it to work after I provided the IP address.
- After I finished configuration of my POP3 account in Outlook I received the following test email in my inbox as confirmation that my SMTP service is working fine
- So now that our SMTP Service is working the next step is to configure SharePoint.
- Open Central Administration and go to System Settings.
- Click on ‘Configure incoming e-mail settings
- Set ‘Enable sites on this server to receive e-mail’ to ‘Yes’
- Ensure that you change the e-mail server to match that of the new domain which you created in hMailServer and specify the drop folder which you manually created earlier.
- Click on OK to save your settings.
- To test that it is working create a new SP2010 document library and go to the library settings. Click on ‘Incoming e-mail settings’
5. Configure the Incoming e-mail settings for the library:
- Configure the Incoming e-mail settings for the library as illustrated in the screenshot below and click on ‘OK’ to save the settings. Note that I specify an e-mail address which of an account which I created in hMailServer earlier.
6. Test Everything:
- Go back to Outlook and select the new POP3 mailbox. Create a new email to be sent from this account and send a test email to the email address of the document library and send the email.
- After outlook performed a send-receive and the email is in your ‘sent items’ go to SharePoint and refresh the document library.
- If everything went well you should see the new email in you library.
Note that when a library is configured to accept incoming email SharePoint will automatically add new columns to the library, but the new columns is not automatically added to the default view..so you can modify the view to see the additional information from the email:
You will also notice that the body of the email is not available as a column.
It is very easy to extract the body information by using an eml reader class. I will how you how to do this in a separate post.
Keep in mind that your environment might be very different than mine and there can be a million things configured which might have an impact on getting this to work for you. My anti-virus was not a problem and my hMailServer service was automatically started.
I hope this post will help you to get incoming e-mail configured for SharePoint 2010 on a Windows 7 machine.