QUERCUS BLOG
Industry Insights from Our Experts

Opening .EML file types in Outlook from SharePoint 2010

Filed under .NET, SharePoint, Usability

If you have ever setup Incoming email on a document library you will have noticed how the emails will arrive into the document library in .EML format. When you click on the .EML file it will either open up in your browser,  or prompt you to Save it to your hard drive. The browser will show  you the main body of the email, but will be missing all the good stuff like TO,CC, BCC Subject, attachments etc.

I’m going to walk you through the steps of setting up SharePoint and IIS to allow you to open these files in Outlook instead. This allows you to see the original email in all it’s glory.

The steps involved are:

  1. Enable Permissive mode on your Web Application (or the document library if needed)
  2. Change the Mime Type for .EML files in IIS
  3. Change the default program for .EML file types on your client machine

 

Step 1 – Enable Permissive mode

When you try to open a file in SharePoint, SharePoint tells the browser whether it can open the file or whether it must be downloaded first, then opened. It does this via a Browse File Handling setting in the Web Application General Settings:

image

By default this setting will be set to Strict. This means that when your users click on a file such as a PDF for example, they will be forced to download the file. Changing this setting to Permissive will allow the file to open in the Browser (if your browser can open it). (Note: you should be aware of the security implications of making this change).

Normally that should be enough, if you try to open a .EML file after making this change it should open in your browser.

If you find that your browser is still forcing you to save the file first, then it is possible your Document Library is still set to Strict mode.

You can check via the SharePoint object model using Powershell

1
2
3
4
5
6
7
8
9
10
11
12
$site = Get-SPSite("http://SharePointSite")
$web = $site.OpenWeb()
$list = $web.GetList("http://SharePointSite/Attachments")

write-output $list.browserfilehandling
if ($list.browserfilehandling -eq "Strict")
{

$list.browserfilehandling = “Permissive” ;
$list.update();

}

or via SPM2010 and change it.

 

Note: You may  also decide to do this per file type. Check out this link for details.

Step 2 – Change the Mime Type for .EML files in IIS

So now we can open the .EML files, but they are opening in the Browser, not in Outlook. This is because IIS is telling the browser that .EML has a Mime Type of message/rfc822, and you’re browser is saying “hey, I can read that!”. We need to configure IIS so that it forces the browser to hand off opening the .EML file to your Windows client.

To do that is pretty easy.

Open up IIS Manager, click on your Server in the left hand side, and choose MIME Types under the IIS section:

image

Now scroll down until you come to the .eml file type:

image

Double click on it and change the Mime Type to be application/octet-stream instead. This will tell the browser that this is a binary file of some type and will need to be opened via a client application. Now when the browser sees this, it will pass the file onto the client for opening.

You will need an iisreset for this change to take affect.

 

Step 3 – Change the default program for .EML file types on your client machine

The final step is to tell Windows what program to use to open the .EML file. In Windows 7 this is straight forward. Go to Control Panel and search for Default Programs:

image

Click the “Associate a file type or protocol”… link and browse to the .EML file type.

Double click and associate it to Microsoft Outlook.

image

And that’s it, from now on you will be able to open .EML files that are stored in SharePoint in your Outlook client.

5 Comments

  1. Aman Kumar Bhardwaj
    Posted December 23, 2011 at 2:35 am | Permalink

    Hi richard,

    It’s good to see you have published this article.
    I have tried the steps you have mentioned. But .eml file is getting open in I.E. like simple text file.

    If you have any other option or suggestion please let me know.
    I’m looking forward from you side,
    Regards,
    Aman

  2. Posted December 23, 2011 at 7:54 am | Permalink

    Hi Aman

    If IE is still displaying the email file then something has gone wrong with step 2 in the article.

    Verify the mime type has definitely been changed for the iis server and not just the site. If you have a multi server farm then you will need to do this for each server. Also do an iisreset on your server(s).

  3. Mario G
    Posted January 23, 2012 at 10:06 pm | Permalink

    I am having the same problem as Aman. The .eml file is still opening in the browser. I have changed the MIME type at the server level in IIS not at the site level. I have performed the IISRESET. I am using IE8.

    The interesting thing is if I use Firefox, I am prompted to open with Outlook as the default or save the file. This would suggest that the MIME type is correct and the behaviour seems related to the browser.

  4. Dimitris Porikos
    Posted February 29, 2012 at 3:04 am | Permalink

    Any ideas in Win7, x64, IE9 with MOSS instead of SharePoint 2010 ???

  5. Posted March 8, 2012 at 11:40 am | Permalink

    Should work ok, you can skip the Permissive/Strict step but changing the mime type in IIS is still important. I’ve done this with MOSS and it’s worked fine.

Copyright 2017 by Quercus Solutions
Login