Thursday, February 3, 2011

SharePoint 2010 Incoming e-mail Settings on Windows 7

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
clip_image002
  • Expand Settings and click on SMTP. Set the ‘Local host name’ to your local machine name.
clip_image004
  • 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.
clip_image006 
  • 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’.
      clip_image008
      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.
      clip_image010
      • 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
      clip_image012
      • 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
      clip_image014
      • 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.
      clip_image016
      • To test that it is working create a new SP2010 document library and go to the library settings. Click on ‘Incoming e-mail settings’
      clip_image018
      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.
      clip_image020
      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.
      clip_image022
      • 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.
      clip_image024
      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:
      clip_image026
      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.
      Have fun!!

      9 comments:

      maria said...

      It is a very nice thing to see your excellent work and I like your article very much. With the growth of companies, SharePoint is emerging at a rapid speed each day. As a company grows, it becomes difficult to manage the documents, files and their position. SharePoint 2010 is beneficial for all with it's new features.

      john.livingston said...

      First of all I'd like to say thanks for writing this up. It was very helpful and I was able to successfully write up workflows and use e-mail enabled document libraries.

      However, I was just wondering if you were able to get this to work with Nintex Workflow 2010?

      I am really struggling with this and wondering if there is an Exchange requirement. I put in a support ticket to Nintex already, but was wondering if you've had any luck.

      Anonymous said...

      Hi! I have been trying out your steps for a dummy email configuration but I couldn't carry the test because I get server messages like:

      ATTACHMENT_REMOVED
      MESSAGE_FILE_MISSING
      MESSAGE_UNDELIVERABLE
      SEND_FAILED_NOTIFICATION
      VIRUS_ATTACHMENT_REMOVED
      VIRUS_SOUND
      VIRUS_NOTIFICATION

      Besides the diagnostics I get are:

      Test outbound port
      SMTP relayer not in use. Attempting mail.hmailserver.com:25
      Trying to connect to host mail.hamailserver.com...
      Trying to connect to TCP/IP address ........ on port 25.
      ERROR: It was not possible to connect.

      Test MX records
      Trying to resolve MX records for domain.org..
      ERROR: MX records for domain domain.org could not be resolved

      Test local connect
      Connecting to TCP/IP address in MX records for local domain domain.org...
      ERROR: MX records for local domain domain.org could not be resolved

      It would be awesome if I could get help on this as I'm still very new to Sharepoint and this is my first time setting up SMTP server.

      john.livingston said...

      Update: Works with Nintex no problem.

      Anonymous said...

      Hello, I was wondering if you have created the post on "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."

      I would be very interested in seeing how this can be done.
      Thanks

      DANNY said...

      Cool.... It was very helpful for me.

      Gilberto Uchôa [GB] said...

      Thanks a lot. I was giving up on hMailServer. One thing though: I could only get the emails to show up on the drop folder after I created an account on hMailServer with the same name as the incoming email address I set in SharePoint to the library (on the library settings). Otherwise the email was refused with a "550 unknown user" error.

      Unknown said...

      Thanks for the article,

      I followed the all instructions and configured the created user account in the "Opera Mail" extension.

      The e-mail is not received from SharePoint library.!!

      I am configuring this for SP2013. Should I need to make entry in host file?

      PDF signature said...

      Very informative post. I sometimes do presentations on SharePoint and was wondering if I could use your Print List example in my presentations and refer my audience to your website for further info.

      Post a Comment