gmail-exporter
Gmail-exporter is a command line utility for exporting a local copy of email messages and related attachments from your Gmail account.
Project status
This project is in beta test, going to apply for google oauth approval.
Features
-
Export email messages to a spreadsheet
-
Optionally export related attachments and put refs into the spreadsheet
-
Optionally export messages as EML and put refs into the spreadsheet
-
Exported messages filtered by label
-
Optional progress status for long tasks
Privacy policy
Gmail-exporter's use of information received from Google APIs will adhere to Google API Services User Data Policy, including the Limited Use requirements.
Usage
Invoke the gmail-exporter
executable passing appropriate options.
Quickstarts
This paragraph shows some usage examples.
Use ./gmail-exporter help
to get the full list of available options.
Export sent messages
./gmail-exporter export SENT
Export messages from trashcan as EML
./gmail-exporter export --save-eml TRASH
List available labels
./gmail-exporter labels
Fine-tune paging
Messages are downloaded in blocks (pages): set the size of each block to max 50 messages
gmail-exporter --page-size 50 TRASH
Read at max 200 pages of messages
gmail-exporter --pages-limit 200 TRASH
Throttling
Limit the transfer of messages at 1 per second
gmail-exporter --messages-per-sec 1 TRASH
Limit the download of attachments at 5 per second
gmail-exporter --attachments-per-sec 5 TRASH
Batch mode
Prevent both opening the browser window for auth and eventually writing the obtained token
gmail-exporter --batch TRASH
Authentication
When the application launches, it requests that the user grant access to data in the relevant Google account.
If the user consents, the application requests and receives a temporary token to access Gmail data. All the exchanged data is just kept within the user local system.
The temporary token is long-lived and saved into your local folder (by default within file token.json).
{
"access_token": "...",
"token_type": "Bearer",
"refresh_token": "...",
"expiry": "2022-07-17T13:30:07.560873398+02:00"
}
How to build
Clone the project and run
go build
How to release
Add a tag with proper message and push it
git tag v0.0.1 -m "First public release for wider testing."
git push origin v0.0.1
Other tools
Looking for other tools to backup your email messages? (and more)
Here are a few alternatives that are worthy of consideration:
Copyright and License
Copyright © 2022-present Davide Cavestro. Use of this software is granted under the terms of the MIT License.
See the LICENSE for the full license text.