Skip to content

sanand0/gmailmbox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

GMail Sync

This script lets me sync GMail to .mbox via the API (not IMAP), allowing me to analyze it offline.

Usage

Clone this repository:

git clone https://github.com/sanand0/gmailmbox.git
cd gmailmbox

On Google Cloud Console, download credentials.json into gmailmbox/:

Then install and run:

# Fetch all emails (excludes spam, trash, and invites by default)
uv run gmailmbox.py --mbox emails.mbox

# Refresh only new emails
uv run gmailmbox.py --mbox emails.mbox --update

# Refresh only new emails matching a query
uv run gmailmbox.py --mbox emails.mbox --update --q "from:user@example.com"

This will sync all emails that match the query to the .mbox file.

Parameters:

  • --mbox: Path to the .mbox file (default: "emails.mbox")
  • --q: Gmail search query (default: "in:anywhere -in:spam -in:trash -invite")
  • --update: Only update new emails (default: False)

About

Download mails from GMail into .mbox via API

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages