How to Move Emails from Google Workspace for Free

Renato Almeida
4 min readMar 23, 2022

The struggles when trying to migrate my teammates’ inboxes from Google Workspace to a new provider.

Google mail logo in blue, dark red, red, yellow and green
Google Mail

First of all, I’m not exactly on IT. Although I’m a laywer, I’ve always tried to help people everywhere I can. That said, I recently saw myself into the mission of migrate my teammates’ inboxes from the not exactly cheap Google Workspace to Hostinger, where we have an inexpesinve regular all-in-one cPanel hosting plan.

Google mail logo with a green arrow pointing to cPanel logo
Migrate Google Mail to cPanel

After visiting every single link on Hostinger’s cPanel email section I wasn’t able to find any feature available that could make it magically happen. Of course, I thought that the misfunctional piece was in front of the screen. It’s hard to believe that a well-know hosting service as Hostinger simply doesn’t provide a tool to do that, once it doesn’t look like rocket science.

Sure I got in touch to its customer service. Yes, in my humble experience, I can easily say that Hostinger has a top rate customer service. Their people are always ready to help on everything you need.

I know it can sound unbelievable but so I figured it out that the problem wasn’t me. There’s no such feature for free email accounts attached to a cPanel hosting plan. Hostinger itself shared the link to a paid service where I could do it. Anyway, at this point, I wasn’t convinced that pay for something I believed is essential for everyone who’s already seen themselves involved in such task was an option.

And that’s why I promptly started a tireless saga looking for a kind of tool, service or anything along that which could help me on accomplishing such migration. If you give a try on Google by yourself, I’m sure you will find a dozen of paid softwares that could do it, but as I said above, I wasn’t keen to pay a penny for it. It was a question of honor now.

There are also several tutorials in the web teaching how to set up source and destination inboxes with an email client in your PC, but it wasn’t what I was looking for. I’d like to find a frictionless solution to help my teammates, I’d like simply to export messages from Google and import them to Hostinger. It couldn’t be that hard. And that’s what came to me.

Okay, we can use Google Takeout to export our messages in the .mbox format. To do that, check the option to export your Mail only, otherwise you’ll get a GB sized takeout that will last several hours to finish. You can also choose which folders you wanna export by selecting the button “All Mail data included”.

Screenshot of Mail option on Google Takeout website
This is what we need for mail export

Now it’s time for some wait. In my case, in less than 1 hour I got my 160MB takeout file. The point is that Hostinger allows us to import files with a 25MB size limit only. Here was when I found out this interesting post on Stackoverflow. I figured out that a .mbox file is nothing than a regular text file with a specific format and, being what it is, it can be simply divided into smaller files following the same format schema.

Here’s when comes to the scene the free Gawk app. A simple and still powerful text handler software that can help us to split the large .mbox file in brand new small files that fits to our needs and can be imported right away to Hostinger. And the Stackoverflow’s post I mentioned above has the key to split it by file size, making our life even easy.

BEGIN{chunk=0;filesize=0;}
/^From /{
if(filesize>=40000000){#file size per chunk in byte
close("chunk_" chunk ".txt");
filesize=0;
chunk++;
}
}
{filesize+=length()}
{print > ("chunk_" chunk ".txt")}

Step by step:

  1. Takeout your messages from Google Workspace
  2. Install Gawk in your computer (for example in c:/awk directory) and put your takeout file in the same folder
  3. Create a splitter.txt file in this same folder and paste the script above over there (here’s where you will set the max file size, replacing the 40000000 according to your needs)
  4. Rename your takeout file to takeout.mbox
  5. Open the command line and go to the installation directory ( for this example, just type cd c:/awk)
  6. Type the command awk -f splitter.txt takeout.mbox and wait till the magic ends (splitted files will spawn in the same folder as well)

Of course this solution doesn’t cover all situations, so please read this notes below from the Stackoverflow’s post linked above too:

  • The size of the result may be larger than the defined size. It depends on the last email size inserted into the buffer/chunk before checking the chunk size
  • It will not split the email body
  • One chunk may contain only one email if the email size is larger than the specified chunk size
  • I suggest you to specify the chunk size less or lower than the maximum upload/import size

Thank you very much for your time and hope it helps! I really appreciate if you have any comments. Also, if you like this article, please like and share it!

--

--

Renato Almeida

From Brazil to the world. Lawyer. Corporate and compliance specialist. Fallen in love for tech & challenges. #web3 enthusiast.