Export Gmail Emails to MBOX in Google Workspace Business
Gmail is the email program you get by choosing the Google Workspace service as your personal/business suite. It’s a web-based service that can be accessed from any browser anywhere. All you need is your correct credentials. However, sometimes, due to compliance demands or self-needs, users request a way to export Gmail emails to MBOX format.
It is not that getting MBOX out of G Suite is impossible, but it is not straightforward either.
That is why, many users report difficulty attempting the process without external guidance. So we provide the correct procedure within this write-up. Here, we will teach you how to use the default process and introduce you to a utility that cuts down on the majority of manual work.
Let us start by understanding why users may choose MBOX over other types of formats.
Reasons to Export Gmail Emails to MBOX in Business Environments
Businesses are constantly evolving and they can’t let digital chokeholds block their communication channels.
However, those operating on a tight budget may not have enough resources to get a perpetual subscription model style archives.
Moreover, deleting those precious client conversations is out of the question. So, the only possible path left is to back up offline and clear out the inbox for new mail.
In some situations, regulatory bodies may require a copy of email communication. Or the organization may have to maintain a separate offline copy for other compliance purposes. These are just some of the reasons the actual list is as large as there are businesses, we are not here to question the genuineness but to provide a way to fulfill this requirement. So for that, you can try out the basic manual method steps which are described below.
Export Gmail Emails to MBOX at the User level
STEP 1:
Login to the Takeout service via the official URL: https://takeout.google.com/
By Default Google Selects all of the different services, so click on Deselect all.
Scroll till you find Mail.
Mark the Checkbox next to it.
Optional: Click on the Multiple formats button to see that Emails are exported out in MBOX format.
Scroll down and click on Next Step.
STEP 2:
A new set of options opens first of which is selecting destination. This is how you decide where you will receive the Google Workspace data.
You can continue with the default “Send download link via email” or expand the transfer bar to select any other option like:
- Add to Drive
- Add to Dropbox
- Add to OneDrive
- Add to Box
Choose the Frequency
Select the File type.
Google Takeout does not release emails in pure MBOX format instead they would be compressed in either .zip or .tgz so choose the one that works best for you.
Pick a File Size. Options include 1GB, 2GB, 4 GB, 10 GB, and 50 GB that zip will automatically cut off at that threshold and start with a new one. This will repeat until all the data is covered.
At last click on Create Export.
In case the MBOX is just a placeholder format and your real intent was to get Personal Storage Tables then you can follow this guide on how to export G Suite email to PST and complete your requirements.
This may seem like the most cost-effective way to get the data in the MBOX format but it has many apparent drawbacks and equally.
Why the Default Method Falls Short?
The first and most severe drawback is that it may be unavailable. This is especially true in a business environment where admins can disable user-level Takeout requests. So only organization-wide single take-out requests can be made.
Another limitation is the lack of filtering capability, so this becomes an all-or-none type of export
Internal limits on the number of requests and the high failure rate of said requests are strong reasons to not choose this route.
If you are an admin and want to enable Takeout feature for your organization follow the guidelines given below.
How Admins Can Enable Takeout for Users
- Sign in to Google Admin Console(GAC) as an super administrator.
- Follow path Menu > Data > Data import & export > Google Takeout.
- Click User Access to Takeout for Google services.
- In the “Services without an individual admin control” section, click Edit.
- Choose Allow for everyone under Gmail service and Save.
- Optional settings include setting up Takeout for OU and Groups.
Now that it’s clear that Takeout is not a good option let’s see the best alternative available in the market.
Use Google Vault and Get Google Workspace Emails in MBOX Format
Pre-requisites:
Super Admin rights.
Turn off Auto-Delete.
Enable message storage.
Steps to Use Google Vault to get Gmail data in MBOX format:
Purchase Google Vault licenses (these are separate licenses)
Add Google Vault licenses to users whose Gmail data you want in MBOX format.
You can ask users to add the Google Vault app by expanding Vault visibility to all users.
In case the super admin is busy Vault export can be done by privileged users as well. However, admin still needs to assign authorization for this.
Visit vault.google.com.
- Login and stay with Default Retention:
- Under Vault’s Retention menu.
- Pick Gmail service.
- Set a Retention Period and corresponding purge period.
Use Google’s Data Export Kit
Step 1. Make a Data Export Request
- Log in to Google Admin console with super administrator privileges
- Expand the left pane Menu > Data > Data import & export > Data Export.
- Press “Set up new export” button.
- Type the name; pick “Export all user data.” keep “Continuous export” unchecked.
- Under Destination pick the closest Google-provided Cloud bucket as per your organization’s location (US, Europe, or No Preference).
- Press “Start export.”
Step 2. Fetch the Exported Data
Note: The following steps can’t be done right after export creation. You need to wait anywhere from 48-hours to 14-days for the download to activate.
- Before continuing check whether or not Google Cloud is on for your admin account. If not then toggle switch it on.
- Once the export is complete you will receive a mail on the admin email used to conduct the export. Click on that link to continue or login to the Data Export tool with the same admin email and hop on to the “View archive” section.
- There should be a review report accompanying the export data with one of three result.
- “Failed,”
- “Complete with errors,”
- “Complete”
- Use the Cloud portal to find individual user files or gsutil for extracting all email items together.
- Finally decompress the .zip and extract the user’s Gmail data.
Build a Custom Script to Download Emails in MBOX via Gmail API
- First, build a new Google Cloud Console or modify an existing one.
- Enable the Gmail API
- Download your OAuth credentials file as ‘credentials.json’
- Install required libraries:
pip install google-api-python-client google-auth-httplib2 google-auth-oauthlib
- Run the script
- The first time you run it, it will open a browser window for authentication
- The script will download all emails to ‘gmail_backup.mbox’
import base64 import os import pickle from googleapiclient.discovery import build from google_auth_oauthlib.flow import InstalledAppFlow from google.auth.transport.requests import Request from email import message_from_bytes import mailbox # Set up OAuth 2.0 scopes SCOPES = ['https://www.googleapis.com/auth/gmail.readonly'] def authenticate_gmail_api(): creds = None if os.path.exists('token.pickle'): with open('token.pickle', 'rb') as token: creds = pickle.load(token) if not creds or not creds.valid: if creds and creds.expired and creds.refresh_token: creds.refresh(Request()) else: flow = InstalledAppFlow.from_client_secrets_file( 'credentials.json', SCOPES) creds = flow.run_local_server(port=0) with open('token.pickle', 'wb') as token: pickle.dump(creds, token) return build('gmail', 'v1', credentials=creds) def download_all_emails_to_mbox(service, user_id='me', mbox_file='gmail_backup.mbox'): # Create an mbox file mbox = mailbox.mbox(mbox_file) # Get list of all message IDs response = service.users().messages().list(userId=user_id, maxResults=500).execute() messages = response.get('messages', []) # Continue fetching if there are more messages while 'nextPageToken' in response: page_token = response['nextPageToken'] response = service.users().messages().list(userId=user_id, pageToken=page_token, maxResults=500).execute() messages.extend(response.get('messages', [])) print(f"Found {len(messages)} messages so far...") total_messages = len(messages) print(f"Downloading {total_messages} emails...") # Download each message and add to mbox for i, msg in enumerate(messages): if i % 100 == 0: print(f"Downloaded {i}/{total_messages} emails...") # Get the message message = service.users().messages().get(userId=user_id, id=msg['id'], format='raw').execute() # Decode the raw message msg_bytes = base64.urlsafe_b64decode(message['raw']) # Convert to email message and add to mbox email_message = message_from_bytes(msg_bytes) mbox.add(email_message) mbox.close() print(f"All emails downloaded to {mbox_file}") def main(): service = authenticate_gmail_api() download_all_emails_to_mbox(service) if __name__ == '__main__': main()
Instead of struggling with the script and endlessly fixing bugs and errors you can choose a tool that does it all for you. The entire process is wrapped in a easy-to-use GUI platform.
Export Gmail Emails to MBOX in an Organization Setting
None is better than what the SysTools G Suite Export Tool offers. The fully GUI-based tool can help in getting the Gmail MBOX data even those who are not from a technical background.
Accurate selection options at Workload, Date, and User levels allow admins to only pull the data they require.
The tool will also fetch the attachments in their original format so you need not download them separately or sync Google Drive with OneDrive saving both time and effort.
To use the software.
Step 1. Start by installing the software on your machine. Open and select G Suite as the source and MBOX as the destination.
Step 2. Go down to the workload selection area and mark the checkbox next to emails, There you will find the option to add a Date Filter as well. So use it if you require it.
Step 3. On the Next Screen, you need to perform Source Validation i.e., authenticate the Google Admin data. Perform it and press Next.
Step 4. After that choose a folder path where the resultant MBOX will be kept and validate it.
Step 5. Next, you will see the mapping screen, use any one of the available options out of Fetch, Import, and Download to add to the user list.
Step 6. In the preview screen check the user list, and mark the box next to the ones you want the data from. Validate and Start Export.
Conclusion
Now users and admins can easily export emails to mbox format irrespective of the Google Workspace plan they subscribe to. The techniques talked about here cover all basic solutions that are available for the general audience. Moreover, we also give you an introduction to an advanced tool that is best suited for complex organization-wide export operations.
Frequently Asked Questions?
Q. Can I send a Takeout Download link to more than one location during a single transfer?
A. No, google only allows one destination selection. If you want to transfer to another portal, do it manually on your own or make a new takeout request and select the other desired option.
Q. Is there a way I can use it to filter the MBOX files before their export in Takeout?
A. No unlike the professional tool, Takeout offers no date filtering capability. The only sort of selection you can make is to decide whether you want the export of the entire Gmail or split it over 6 installments of past one-year conversations.
Q. Does Google offer any way to track the progress of an ongoing Export?
A. Real-time tracking is not possible, you only receive a message when the export is done.