Store imap emails before server gets shut down

I am currently using a mail server with thunderbird which only supports IMAP, meaning that the mails are kept on the server and thunderbird always connects and sees if something has changed.
Now my problem is, the server will be shut down in a couple of days, but I would like to keep access to the mails that I have received (and sent). Is there a practical way to download emails via IMAP and store them in a way that does not need to connect to the server? I do not care if I use thunderbird, evolution, any other email client or a cli tool, as long as it is open source.
Thanks for any suggestions!

Thunderbird (TB) keeps a local copy of all your “subscribed” IMAP folders. When your email server cannot be reached, TB will complain that your IMAP folder is not available for refreshing your inbox, however, it will still display all your emails.

You can simulate that by disconnecting your machine entirely from the network, start Thunderbird, read your email that you downloaded before going offline.


May be more secure is to create a Thunderbird local folder, select all e-mails and copy to that local folder. If a new IMAP server is in place, just go the other way around.


Yeah, I guess creating a local folder and copying emails is the best solution. I had issues in the past when the server would all of a sudden be responding something else than my emails.

Otherwise, changing the server address ahead of the announced shutdown date might solve the issue, too. Offline mode certainly did work.