Mark's Business Consulting, Support & Services Blog

OK so here is the scenario. You've got a lot of emails on an IMAP server but your server needs to change or you are going to stop using that email account but you want to keep a copy of your emails. So first let us understand what an IMAP server is.

What is an IMAP Email Server?

If your email is on an IMAP (Internet Mail Access Protocol) server it means that your emails are always on that server. When you look at them from your computer, you are looking at a temporary copy. They stay on the server until they are deleted (and you empty your trash can) or until you move them off, which is what we'll be doing here.

There are advantages to IMAP servers:

  1. You can access your emails from multipe devices and they all stay synchronized.
  2. You can access your emails from a web interface.
  3. You can move emails from one IMAP server to another.

So what we want to do is copy your emails from your IMAP server onto your local hard drive so that you don't loose them when that server is no longer available or you close your email account.

This Example of Backing Up Emails From an IMAP Server Using Thunderbird

OK I'm going to be archiving off my LionAid email account. markATlionaid.org. I'm working on a MacBook Air Mac OS X and I'm using the Thunderbird Email Client version 45.7.1. But the theory of what I do here will work on other email clients and on other operating systems. Note my thunderbird is set up with multiple email accounts. I will be blurring out stuff which you don't need to see so you can focus on this tutorial.

Step 1. Create a New Local Email Folder To Keep Your Archived Emails in

Thunderbird archive emails tutorial

Looking at the picture above. On the left hand side you will see your email account. If you have multiple accounts like me then you will see each one listed. Notice at the bottom it says "Local Folders" well that's where we're going to start.

Tutorial Thunderbird email backups

As shown above. Right click on the "Local Folders" and select the option "New Folder..." we are literally going to make a new folder and for this example I'll call it "LionAid_Archive".

Creating a local folder in thunderbird

A really handy hint is to not use '.' or '-' characters in the folder names. Stick to numbers, letters and underscores '_' only. If you use the period '.' for example and call the folder "my.email.backups", the system may actually create three folders, one inside the other like "my/email/backups", which would not be desireable.

Making a local folder in thunderbird email client

OK so now you can see we've got a new folder called "LionAid_Archive" under the Local Folders.

Step 2. Tell Thunderbird to Make Archives to Our Local Folder.

OK so lets tell Thunderbird that we want our archives for this email account to be stored in this new local folder. By default Thunderbird will create archives on the mail server. We want any archives created to be on our local machine so that when the server is no longer available we still have our archives.

Setting up an account in thunderbird

In the menu at the top go to Tools -> Account Settings (this is on a Mac, it may be elsewhere on Ubuntu or Windows, but you'll find it). You'll see a large popup window appear.

Archive off emails from IMAP

Click on "Copies and Folders" under the email account you wish to archive off. Make sure you are working on the right email account!
On the right hand side about half way down you'll see the "Message Archives" section which I've highlighted in red above.

setting up offline archiving in thunderbird

Tick the second radio button for "Other:" and in the drop down list go to "Local Folders" and then find the folder you just created and select it.
Now hit the "OK" button at the bottom.

Creating an email archive folder in thunderbird

You'll notice that the folder icon for the newly created folder has changed and looks like, well... an archive.

We're half way there. Have a cup of tea or a little break to stretch your legs.

Step 3. Automating the Archiving of Your Emails Using Message Filters in Thunderbird

Go to Tools and then Message Filters.

Setting up message filters in Thunderbird

In the window that pops up select the email account (mark@lionaid.org in this example) you wish to archive off.

Create a new Message Filter

Then click the "New..." button on the right to make a new message filter. A new window will then popup.

Creating a Message Filter in Thunderbird to Archive Off Your Mail

Creating an email archiving message rule

This is really simple so I'll break it down into little steps. The image above pretty much shows you everything you'd need to do.

  1. Firstly give the filter a meaningful name. I called mine "Auto Archive of mark@lionaid.org for Offline Use". You get the idea. The name should do what it says.
  2. Next make sure the "Archiving" checkbox is NOT ticked.
  3. Make the "Getting New Mail:" option "Filter after Junk Classification" so that you avoid archiving off a load of junk emails.
  4. Then set up a rule like the one I've shown:
    Match all of the following: [Age in Days] [is greater than] [0]
    Perform these actions: [Move message to] [the folder you created in step 1.]
  5. Click the big "OK" button.

Message filter list in Thunderbird

You will see your newly created filter listed. Congratulations!

How To Archive Off Thousands of Emails

If you've got lots of emails, like more than 1000 or you've been using your account for years then you'll want to break the archiving down into managable chunks. This is also a good strategy if you've got emails in lots of different folders or you specifically want to archive off different years into different folders. If this is the case then read on otherwise if you want to keep it simple and you've not got that many emails then jump to Step 5.

Step 4. Archiving Emails off By Year, Size, or By Sender in Thunderbird using Message Filters.

You can get a lot more creative with Message Filters in Thunderbird. These three examples below show you how to be more selective with which message get archived.

Example: Archive Off Emails From a Specific Date Range

Date range email message filter

In this example we are saying archive emails who have a date between the end of 2012 and the start of 2014. This means emails from 2013.

Example: Archive off Emails From a Specific Sender

Email sender filter thunderbird

In this example any emails which come from example.com will be archived off.

Example 3: Archive off Emails Which Are Large in Size (Attachments)

Filter by email size

In this example any emails larger than 100KB are archived off. This should include any emails with attachments. Smaller emails will be left on the IMAP server.

Important Considerations for Message Filters

  • When you Run a message filter you can choose which folder is the target of the filter. In this way you could go to specific folders.
  • If a filter is enabled (has a tick next to it) and the "Getting new Mail" checkbox is ticked then the filter will automatically be applied to all emails arriving at the inbox.
  • You can run message filters on your "Sent", "Junk" and Trash folders too.
  • You can have multiple filters in place. They are run in the order they are listed.

Step 5. Run the Message Filter To Archive Off Your Emails to Offline Disk Using Thunderbird

OK so you've setup your message filter and you are ready to move your emails from the IMAP server to your local hard disk so you can access them even if the IMAP server is shut down or you cancel your email account.

Running message filters

  1. Make sure the email account you are interested in is selected in the Filters for: section.
  2. Then click on the newly created filter so it is highlighted.
  3. In the Run selected filter(s) on: section you can select which folder on the server you want to run the filter against. The default is the Inbox. This is one way of archiving individual folders.
  4. Click the "Run Now" button.

 Compact folders

You may get asked if you want to Compact Folders. Unless you are running out of hard drive space then I would recommend you click Cancel. Compressing folders takes up time and makes the computer work hard. It can also slow down the accessing of the compressed folders, making performance worse. Only do it if you really need to save space or you don't plan to access the archived emails for some time.

How Do you Know if your Emails Have Been Archived Off From the IMAP Server?

Status bar in thunderbird

You'll notice right at the bottom in the status bar that Thunderbird shows you what it has just done. In this case it archived off 34 messages, which is exactly what I expected!

You should find that your emails are no longer in your account and are now found in the Local Folder sub folder. So the next thing you're probably wanting to check is that those emails really are on your local folder and are not on a remote server. The simple way to do this is to tell Thunderbird to Go Offline and see if you can still access your emails in your archive folder.

How to Put Thunderbird in Offline Mode

Offline Mode for Thunderbird

In the menu click on "File" -> "Offline" -> "Work Offline" and you will see that the little icon in the very bottom left corner changes to show you are now in "offline mode". Repeat the process to go back online when you want.

Ofline mode indicator with thunderbird

So once you are in offline mode you can check to see if you can still fully access your archived off emails. If you can then that's perfect! Well done. Time for another cup of tea!

Did You Know You Can Now Do the Following?

  1. You could use a similar process to copy emails from one IMAP server to another. For example from your current IMAP email account to an IMAP email account with Google or 123-Reg for example.
  2. You can use a similar process to move your archived off local emails onto an IMAP server in the future. Emails are emails so whether they are locally stored or on an IMAP server you can move them around.
  3. You can use the Message Filters to create all kinds of rules, for example any email from this person automatically goes into this particular folder.

The possibilities are quite powerful and in this tutorial I've shown you how to get started with offline emails and message filters.

Posted by Mark Zaretti at 13:49

No comments have been posted yet.


Add a new comment

Existing user

New user sign up


The Internet is Awesome: Understand Internet Neutrality

As a professional web developer with clients all over the world it's my job to keep an eye on the "internet". One of the biggest challenges that will impact all of us is the constant attempt by corporations such as Comcast in the US to take over the web. With massive budgets and lobbying they are trying to make the internet a two tier system. This means that services like Vimeo, YouTube and Netflix will go up in price and that many websites will find themselves "slower" than their corporate competition. If you care about your internet and net neutrality then take a moment to find out more and click the button. You need the net, and the net needs you! Thanks, enjoy and share my blog.

Click for More