Importing eml-files into Outlook

Import EML buttonIf you’ve ever used Outlook Express, Windows (Live) Mail, Thunderbird, Lotus/IBM Notes or basically any mail client other then Outlook, chances are that you have some eml-files stored somewhere as well.

While Outlook does support opening eml-files, it doesn’t offer a way to import them into Outlook.

This guides contains instructions and 2 scripts to import eml-files into an Outlook folder of your choice.


Importing a single eml-file

eml-file buttonIf you only need to import a single eml-file, then you can simply double click on the eml-file to open it with Outlook. If it doesn’t open with Outlook, set Outlook as the default handler for eml-files.

Once the message is open, you can use the “Save” button to store it in the Inbox folder or the “Move” command to save it to the folder of your choice;

  • File-> Move to Folder

Even eml-files from Outlook Express can be opened and saved in Outlook.
Even eml-files from Outlook Express can be opened and saved in Outlook.

Native import script (slow)

VBS Script buttonThe native import script uses the built-in Windows and Outlook scripting capabilities to open each eml-file and move it into a folder of your choice.

This method is relatively slow since Outlook can only do something with the eml-message once it has been opened visually. This is why there is a “Sleep” statement of 1 second (1000 milliseconds) in the script. If your computer is slow to open the eml-files, then you may need to increase this value. If you are in this situation, see the note at the bottom of the script.

This means that this script can import up to 60 eml-messages a minute.

Important!
Verify that Outlook is set as the default application to open eml-files on your computer before running the script.

  1. Download the script files; importemlfiles.zip
  2. Open or extract the zip-file and double click on; import-eml.vbs
  3. Select the folder containing the eml-files that you want to import.

    Select the folder containing eml-files.

  4. Select the Outlook folder you want to import the eml-files into.

    Select Outlook folder for eml import.

    • Note:
      The Outlook folder selection dialog may load in the background. When it does, select Outlook on the Task Bar and, if needed, cycle through your open Outlook windows to find it. It is usually the one that you viewed last.

  5. Important! Once you’ve selected the folder, do not provide any further input via your mouse, keyboard, touch, pen, or any other method. As said before, Outlook needs to open these message visually and changing focus will interrupt the script; Simply wait for the “Import completed.” dialog.

    Import eml completed.

Dim objShell : Set objShell = CreateObject("Shell.Application")
Dim objFolder : Set objFolder = objShell.BrowseForFolder(0, "Select the folder containing eml-files", 0)

Dim Item
Dim i : i = 0
If (NOT objFolder is Nothing) Then
  Set WShell = CreateObject("WScript.Shell")
  Set objOutlook = CreateObject("Outlook.Application")
  Set Folder = objOutlook.Session.PickFolder
  If NOT Folder Is Nothing Then
    For Each Item in objFolder.Items
      If Right(Item.Name, 4) = ".eml" AND Item.IsFolder = False Then
	objShell.ShellExecute Item.Path, "", "", "open", 1
	WScript.Sleep 1000
	Set MyInspector = objOutlook.ActiveInspector
	Set MyItem = objOutlook.ActiveInspector.CurrentItem
	MyItem.Move Folder
	i = i+1
      End If
    Next

    MsgBox "Import completed." & vbNewLine & vbNewLine & "Imported eml-files: " & i & _
	   vbNewLine & "Imported into: " & Folder.FolderPath, 64, "Import EML"

    Set Folder = Nothing
  Else
    MsgBox "Import canceled.", 64, "Import EML"
  End If
Else
  MsgBox "Import canceled.", 64, "Import EML"
End If

Set objFolder = Nothing
Set objShell = Nothing

VBS code to import eml-files into Outlook.

Note:
Depending on the responsiveness of your computer and the amount of add-ins that you have installed in Outlook, you could reduce the waiting period to speed up the import process or increase the value behind WScript.Sleep to make it more reliable by giving Outlook more time to load. When the message doesn’t get enough time to load, the script will fail.

Redemption importing script (fast)

VBS Script buttonThe Redemption script provides the same interface as the native script but relies on the (free) Redemption scripting library which allows you to import the messages via background process. The Redemption scripting library is created and maintained by fellow Outlook MVP Dmitry Streblechenko who created it to simplify various programmatic scenarios for Outlook.

This means that there is no need to open the messages visually, no need to add or tweak a Sleep statement, nor do you have to leave your computer idle to prevent interrupting the script. The added benefit of this is that it is much (much!) faster and reliable.

The only downside is that you need to install the Redemption scripting library which may be an issue on locked down (corporate) computers. If you are in this situation, see the note at the bottom for a possible workaround.

  1. Download the script files; importemlfiles.zip
  2. Extract the file.
  3. Click here to go to the Redemption website and download and install Redemption;
    1. Download the Developer version which can be used for free.
    2. Extract the Redemption.zip file and double click on Install.exe.
    3. Follow the instructions to install Redemption. Accepting the defaults is fine.

      Install Redemption

  4. Return to the location where you extracted the script files in step 2 and double click on import-eml-rdo.vbs
  5. Select the folder containing the eml-files that you want to import.

    Select the folder containing eml-files.

  6. Select the Outlook folder you want to import the eml-files into.

    Select Outlook folder for eml import.

    • Note:
      The Outlook folder selection dialog may load in the background. When it does, select Outlook on the Task Bar and, if needed, cycle through your open Outlook windows to find it. It is usually the one that you viewed last.

  7. Simply wait for the “Import completed.” dialog.

    Import eml completed.

Dim objShell : Set objShell = CreateObject("Shell.Application")
Dim objFolder : Set objFolder = objShell.BrowseForFolder(0, "Select the folder containing eml-files", 0)

Dim Item
Dim i : i = 0
If (NOT objFolder is nothing) Then
  Set WShell = CreateObject("WScript.Shell")
  Set objOutlook = CreateObject("Outlook.Application")
  Set Folder = objOutlook.Session.PickFolder
  If NOT Folder Is Nothing Then
    For Each Item in objFolder.Items
      If Right(Item.Name, 4) = ".eml" AND Item.IsFolder = False Then
        Set objPost = Folder.Items.Add(6)
        Set objSafePost = CreateObject("Redemption.SafePostItem")
        objSafePost.Item = objPost
        objSafePost.Import Item.Path, 1024
        objSafePost.MessageClass = "IPM.Note"
        ' remove IPM.Post icon
	Set utils = CreateObject("Redemption.MAPIUtils")
	PrIconIndex = &H10800003
        utils.HrSetOneProp objSafePost, PrIconIndex, 256, true 'Also saves the message
	i = i + 1
      End If
    Next

    MsgBox "Import completed." & vbNewLine & vbNewLine & "Imported eml-files: " & i & _
	   vbNewLine & "Imported into: " & Folder.FolderPath, 64, "Import EML"

    Set Folder = Nothing
  Else
    MsgBox "Import canceled.", 64, "Import EML"
  End If
Else
  MsgBox "Import canceled.", 64, "Import EML"
End If

Set objFolder = Nothing
Set objShell = Nothing

VBS code to import eml-files into Outlook with Redemption.

Note:
If you can’t use the installer to install Redemption due to a lack of administrator rights on your computer, you can type the following command in the Run Command, a Command window, a PowerShell window or even the Address Bar of File Explorer to register the Redemption library;

  • regsvr32.exe <full folder path>\Redemption.dll

Import Tools

Tools buttonBelow in an overview of trustworthy EML import tools which I’ve used myself;

  • Import EML to Outlook
    Free for non-commercial use. It does not work on Domain joined computers.
  • ReliefJet Essentials
    Commercial version of tool listed above which also works in Domain environment. Additionally, it offers many other useful Outlook tweaks and features.

Import feature in ReliefJet Essentials for Outlook.
Import feature in ReliefJet Essentials for Outlook.