Syncing email locally

To sync our email from the service provider to our computer, we can use an email client such as Thunderbird or any of the many others available.
But if we want, for example, to read our email with mutt (even offline), or to make an archive / backup of our email, we can use offlineimap.
On Ubuntu and derived distributions, just install offlineimap with the command
sudo apt install offlineimapWe can create a file called .offlineimaprc in the home folder with the following content:
[general]
accounts = MyAccount
maxsyncaccounts = 1
[Account MyAccount]
localrepository = Local
remoterepository = Remote
[Repository Local]
type = Maildir
localfolders = ~/Mail/
[Repository RemoteOld]
type = IMAP
remotehost = <server ip/address>
remoteuser = <remote user>
remotepass = <remote user password>
ssl = yes
#ssl_cert_verify = no
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
#readonly = trueSome remarks about the options used.
readonly = trueWe use this option to make sure the sync only goes from the server to the local folder.
sslcacertfile = /etc/ssl/certs/ca-certificates.crtUsed on a Pop_OS! installation, but equally valid for Ubuntu 22.04. If you use another distribution, check where it keeps its certificates.
Once the file is configured with your details, you just need to run offlineimap and wait for it to finish.
offlineimapFor more information you can always visit the project website at https://www.offlineimap.org/
Photo by Daria Nepriakhina 🇺🇦 on Unsplash