How to download Outlook attachments from multiple emails to a local folder

How to download Outlook attachments from multiple emails to a local folder

Downloading attachments from a single email is very easy. Most clients offer a way to download ZIP files. But it’s tricky when it comes to extracting or downloading Outlook attachments from multiple emails. Since this feature is not offered in advance by any of the online or offline clients, we will have to find scripts and tools to implement it.

How to download attachments from multiple emails in Outlook

You can use any of these methods to download attachments. This will require VB Script, so make sure you have enough permissions for your account.

  1. NirSoft OutlookAttachView
  2. Custom VB Script

Each tool has its own advantages and disadvantages. Make sure you know about them before choosing which one to use.

1] NirSoft OutlookAttachView

If you are using the Microsoft Office version of Outlook to receive email, you can use a free software called OutlookAttachView to download all of your attachments. It has been working with all types of Outlook since 2003, although explicit Outlook is not supported.

To get started, download the software (get the 64-bit version if you’re using the 64-bit version of Outlook), unpack the ZIP file, and open OutlookAttachView.exe.

The mailbox scan options will open. You can specify which attachments you want to scan. Among others, the options consist of:

  • Which Outlook profile to scan
  • Scan messages created in the last X days
  • Exclude certain types of documents
  • Scan messages from specific people
  • Scan attachments containing specific text content

Follow these steps to extract attachments:

  • After installing the software, leave everything as default if you really want every attachment in your inbox to be saved. Set up the software. When you’re ready to start scanning, click OK.
  • The scan is fast; however, it will obviously take longer if you have received a massive archive of emails. Unfortunately there is no progress bar on the scan, so you can’t tell how far it’s gone, so you’d better leave it running in the background and come back later to see if it’s finished..
  • Once the scan is complete, you will be able to preview and view all attachments with columns showing entries such as file name, file length, and extension.
  • To select specific attachments, hold Ctrl and left-click each line in turn. Alternatively, press Ctrl + A to highlight (select) all attachments.
  • Then click the “File”menu and click “Copy selected attachments to”(press F4). You can specify where to export attachments and format document names. When you’re ready, click OK.
  • It will download or save all selected attachments to the target folder.

However, they cannot be removed from your emails, so you can still access them through Outlook if you wish.

2] Using VB Script

This segment demonstrates VBA code in a walkthrough that will help you save all attachments from different emails to the selected folder at the same time.

  • First, you need to create a folder to save attachments on your local drive. Use File Explorer and a known location to create a folder and name it Attachments.
  • Select the emails you want to download attachments from and then press Alt+F11 to open the Microsoft Visual Basic Programs window.
  • Click “Insert “> “Module”to open the “Module”window, copy one of the following VBA codes into the window.
  • Press F5 or use the menu to run the code and all attachments from the selected email will be downloaded or copied to the Attachments folder.

VBA code

Dim GCount As Integer
Dim GFilepath As String
Public Sub SaveAttachments()
'Update 20200821
Dim xMailItem As Outlook.MailItem
Dim xAttachments As Outlook.Attachments
Dim xSelection As Outlook.Selection
Dim i As Long
Dim xAttCount As Long
Dim xFilePath As String, xFolderPath As String, xSaveFiles As String
On Error Resume Next
xFolderPath = CreateObject("WScript.Shell").SpecialFolders(16)
Set xSelection = Outlook.Application.ActiveExplorer.Selection
xFolderPath = xFolderPath & "\Attachments\"
If VBA.Dir(xFolderPath, vbDirectory) = vbNullString Then
VBA.MkDir xFolderPath
End If
GFilepath = ""
For Each xMailItem In xSelection
Set xAttachments = xMailItem.Attachments
xAttCount = xAttachments.Count
xSaveFiles = ""
If xAttCount > 0 Then
For i = xAttCount To 1 Step -1
GCount = 0
xFilePath = xFolderPath & xAttachments.Item(i).FileName
GFilepath = xFilePath
xFilePath = FileRename(xFilePath)
If IsEmbeddedAttachment(xAttachments.Item(i)) = False Then
xAttachments.Item(i).SaveAsFile xFilePath
If xMailItem.BodyFormat <> olFormatHTML Then
xSaveFiles = xSaveFiles & vbCrLf & "<Error! Hyperlink reference not valid.>"
Else
xSaveFiles = xSaveFiles & "<br>"& "<a href='file://"& xFilePath & "'>"& xFilePath & "</a>"
End If
End If
Next i
If xSaveFiles <> ""Then
If xMailItem.BodyFormat <> olFormatHTML Then
xMailItem.Body = vbCrLf & "The file(s) were saved to "& xSaveFiles & vbCrLf & xMailItem.Body
Else
xMailItem.HTMLBody = "<p>"& "The file(s) were saved to "& xSaveFiles & "</p>"& xMailItem.HTMLBody
End If
End If
xMailItem.Save
End If
Next
Set xAttachments = Nothing
Set xMailItem = Nothing
Set xSelection = Nothing
End Sub

Function FileRename(FilePath As String) As String
Dim xPath As String
Dim xFso As FileSystemObject
On Error Resume Next
Set xFso = CreateObject("Scripting.FileSystemObject")
xPath = FilePath
FileRename = xPath
If xFso.FileExists(xPath) Then
GCount = GCount + 1
xPath = xFso.GetParentFolderName(GFilepath) & "\"& xFso.GetBaseName(GFilepath) & ""& GCount & "."+ xFso.GetExtensionName(GFilepath)
FileRename = FileRename(xPath)
End If
xFso = Nothing
End Function

Function IsEmbeddedAttachment(Attach As Attachment)
Dim xItem As MailItem
Dim xCid As String
Dim xID As String
Dim xHtml As String
On Error Resume Next
IsEmbeddedAttachment = False
Set xItem = Attach.Parent
If xItem.BodyFormat <> olFormatHTML Then Exit Function
xCid = ""
xCid = Attach.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x3712001F")
If xCid <> ""Then
xHtml = xItem.HTMLBody
xID = "cid:"& xCid
If InStr(xHtml, xID) > 0 Then
IsEmbeddedAttachment = True
End If
End If
End Function

You can also copy the code from here and paste it.

How to download attachments from multiple emails in Gmail

SendPulse’s free Save Emails and Attachments add-on for Gmail exports your attachments to Google. What makes it stand out is that it automatically starts searching for new attachments, which means you should never think about doing this method manually. It works correctly for a one-time export if that’s all you need.

Note. The service will have access to your Gmail account, so make an informed choice if you want to connect.

Follow the instructions to use this tool

  • Go to the add-on web page and click Install.
  • Select your Google account and click “Allow”and then finish.
  • Go to Google Sheets and create a new table.
  • Visit Add-ons > Save Emails and Attachments > Open Sidebar.
  • Set the label of the Gmail you want to scan for, then specify other filters, such as who the email is from or after, and earlier than the date range (you want to set at least those filters).
  • Click “Upload Settings”, set them up as needed, then click “Select Folder”to select the folder on your drive where attachments should be stored.
  • When you’re done, click Save Rule > Run. The add-on will even auto-run in the back and update as new emails arrive.

You can store attachments inside the drive. Alternatively, open the drive, right-click the folder, and select Load to save a local replica. You can then delete the folder from disk to free up cloud storage.

Download extension from here

How to download attachments from multiple emails on any mail server

Mail Attachment Downloader is an affordable option as it works in many email services such as Outlook, Gmail, AOL, Yahoo, or any mail server. It’s also free for personal use.

The downside is that there are a few add-ons that you can get in the paid version. This includes the ability to practice a couple of filters and upload from multiple accounts at the same time. You can find the complete difference on the software licensing page.

Note. You will need to enter your email credentials here. So make sure you have complete confidence and make an informed choice.

Let’s take a look at the easiest step to extract attachments from multiple emails.

  • Download the ZIP, extract it and run the EXE installer inside. Once connected, launch the mail attachment downloader.
  • Click “Settings”. Here you can select a mail server (whoever submitted your email) after which you enter an account and password. Be sure to read the black bar at the bottom, including important information.
  • When ready, click Test Connection. If that doesn’t work, make sure you have enabled the POP/IMAP protocol as required and that your account challenge and password are correct. When you’re right, click Save.
  • If you want attachments to be output to a unique folder, change the save area. You can further customize this system using tabs. For example, in folder/documents, you can restrict the search to selected folders. When searching, you can specify a range of dates. In the filters, you can specify questions consisting of the sender or the problem string.
  • When you’re ready, click Connect and Download. It will then save your attachments to the folder of your choice.

Download from the official site. The software offers a free version for personal use.

Final words

Downloading multiple attachments from multiple emails should be a feature in all email clients. I use a script to download PDF documents that I receive from clients every day at the end of the month. This ensures that I have copies of everyone and don’t waste time downloading them individually.

Leave a Reply

Your email address will not be published. Required fields are marked *