How to Backup Emails using IMAP Grab on Linux

Windows Articles

How to get Google Opinion Rewards in any Country

Greetings! Google Opinion Rewards is a cool app, which will allow you to earn credit, to spend it on the Google Play...

How to change the hostname on Ubuntu?

This simple tutorial will teach you how to change the hostname on Ubuntu. The steps we will tell you here will work...

How to install Screaming Frog SEO Spider on Ubuntu 20.04 / 18.04?

If you are working with blogs and content creation then you should know about SEO. Or in the best case, you have...

How to Configure a Firewall in Ubuntu 20.04 / Debian 10?

There is nothing safe from hackers on the Internet, however, we can implement security measures to be more protected against an attack. With this...

Gnome 3.38 available

Gnome OS is a Linux-based operating system, which has a huge domain in the Linux forums. On September 16, 2020, developers announced...
Mel Khamlichi
Mel Khamlichihttp://www.osradar.com
Founder of Osradar, from Amsterdam Netherlands

Email is in our everyday life. It’s the ultimate system that changed the way of our communication for good. We now send emails for almost endless reasons. That’s why it’s also necessary to take backups of your email in case you face the need of an old email. Opening the web browser, log into your email account surely takes time. You can use Thunderbird, but the profile is prone to get lost if you need to setup your OS. Learn how to backup Thunderbird profile.

For those on Linux, there’s a really awesome way to back up your complete email without following all those complicated GUI. Trust me, in this scenario, the CLI is hundred times friendlier than the GUI tools.

IMAP Grab

We’ll be using a tool named IMAP Grab. It’s available on any version of Linux distribution, but it doesn’t come up pre-installed. We’ll be downloading it from the GitHub.

  • Prerequisites

We’ll be needing some apps and packages beforehand to run the tool perfectly. At first, check out your installed Python version.

python --version

If the result returns Python v2.3.3 or higher, you’re good to go. Otherwise, update your software.

Now, we’ll be needing another dependency called “getmail”. Let’s install it right away!

  • Ubuntu
sudo apt install getmail

  • OpenSUSE
sudo zypper install getmail
  • Fedora
sudo dnf install getmail
  • Arch Linux
sudo pacman -S getmail
  • Downloading IMAP Grab

This part requires installing Git client on your system. Learn how to install Git on Linux.

Run these commands in the terminal –

git clone https://github.com/ralbear/IMAPbackup.git
cd IMAPbackup
  • Using IMAP Grab

Before we start using IMAP Grab for backing up our email, we have to configure the system first. Run this command –

python imapgrab.py imapgrab.py -l -s imap.test.com -u testuser@test.com -p emailpassword

Replace with your own email & password. Change “imap.test.com” with the IMAP server address your email service uses. For example, Gmail uses “imap.gmail.com” Now, the result will show you all the available mailboxes to download.

Now, run these commands for backing up your entire email. Note that we’ll be creating a dedicated folder for the downloading.

mkdir ~/email-backups
python imapgrab.py -d -v -M -f ~/email-backups -s imap.test.com -u test@test.com -p emailpassword -m "_ALL_"

Done! Your email is backed up!

If you want to turn the entire backup into one single file, run this command –

tar -jcvf email-backup.tar.bz2 email-backups

If you didn’t know, you can easily encrypt the compressed file. Learn how to encrypt files on Linux.

More articles

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

How to get Google Opinion Rewards in any Country

Greetings! Google Opinion Rewards is a cool app, which will allow you to earn credit, to spend it on the Google Play...

How to change the hostname on Ubuntu?

This simple tutorial will teach you how to change the hostname on Ubuntu. The steps we will tell you here will work...

How to install Screaming Frog SEO Spider on Ubuntu 20.04 / 18.04?

If you are working with blogs and content creation then you should know about SEO. Or in the best case, you have...

How to Configure a Firewall in Ubuntu 20.04 / Debian 10?

There is nothing safe from hackers on the Internet, however, we can implement security measures to be more protected against an attack. With this...

Gnome 3.38 available

Gnome OS is a Linux-based operating system, which has a huge domain in the Linux forums. On September 16, 2020, developers announced...
x