GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - aadr1024/get-gmail-full-thread

BranchesTags
Open more actions menu

Latest commit

 

History

6 Commits
6 Commits

Folders and files

NameName
Last commit message
Last commit date
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
credentials.sample.json
credentials.sample.json
 
 
gmail_thread_to_text.py
gmail_thread_to_text.py
 
 
requirements.txt
requirements.txt
 
 

Repository files navigation

Gmail full thread to plain text

Setup (fast path):

  1. Google Cloud Console -> enable Gmail API
  2. Create OAuth Client (Desktop app)
  3. Download OAuth JSON to this folder
  4. Easiest: copy+edit template cp credentials.sample.json credentials.json

    then paste your real values into credentials.json

  5. No pip install needed: dependencies are in-file and uv handles them.

Usage:

  • By message ID (from Gmail URL): uv run gmail_thread_to_text.py --message-id FMfcgzQdzcrhbbpvkRHTbGBCLpftmKTq --out thread.txt

  • By Gmail URL: uv run gmail_thread_to_text.py --gmail-url "https://mail.google.com/mail/u/0/#search/ryan/FMfcgzQdzcrhbbpvkRHTbGBCLpftmKTq" --out thread.txt

  • By search query (first match): uv run gmail_thread_to_text.py --query "ryan" --out thread.txt

  • By RFC822 Message-ID (from “Show original”): uv run gmail_thread_to_text.py --query "rfc822msgid:" --out thread.txt

Options:

  • --thread-id
  • --include-html-fallback (if no text/plain part)
  • --all-threads (dump up to --max threads for a query into one file)
  • --max (default 200; Gmail API limit 500)

Notes:

  • First run opens a browser to authenticate; token.json saved.
  • Output is plain text with message separators.
  • A single thread returns all messages; --max only caps number of threads returned for a query.
  • If you get "Invalid message id", use --query with subject/from or use Gmail "Show original" and pass: --query "rfc822msgid:"
  • If you used a subject/from query and got only one message but expect more, add: --all-threads --max 10

Clipboard trim helper (macOS) to remove line breaks/spaces in Message-ID: pbpaste | tr -d ' \n\r' | pbcopy Then paste the cleaned Message-ID into the command.

Security:

  • credentials.json and token.json are gitignored.

OAuth testing mode fix (Error 403: access_denied):

  • In Google Cloud Console -> OAuth consent screen -> Test users
  • If the console redirects, open: https://console.cloud.google.com/auth/overview?project=<YOUR_PROJECT_ID>
  • Add the Gmail account you are logging in with (e.g., [email protected])
  • Save, then re-run the command.

License:

  • MIT (see LICENSE).

About

No description, website, or topics provided.

Resources

Readme
MIT license
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.