'How to archive GMail folders from local GNOME Evolution?

I have a GMail account configured in my Ubuntu Online Accounts that I access in GNOME Evolution where I sync all messages to my local storage. I want to archive its contents so I can easily restore them back in Evolution later.

I will not be using that GMail account for a while, so I want to remove it from Online Accounts to stop it connecting, and move the account contents out of Evolution to unclutter it. The GMail account will continue to exist though I don't access it through Evolution. If I have to occasionally access the contents I will connect to the GMail webpage for it. I would also like to be able to restore the archive locally without connecting to the remote GMail account itself. I might delete the GMail account, but I'd like to be able to restore the contents locally so I can access the contents anyway, even if I don't send/receive messages. If it matters, it's only the emails I want, not the contacts/calendar/etc items.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source