Clone wiki

mgmail / Home

What is this

mgmail is python library which communicates with gmail service using mobile API.

get_chats.py is simple script which helps you to backup all your chat history from gmail.

Usage

Usage: get_chats.py [options] username

Options:
  -h, --help            show this help message and exit
  -s START, --start=START
                        start with START thread.
  -t TIMEZONE, --timezone=TIMEZONE
                        timezone in form +nnnn (default: +0000); server
                        returns date in local time.
  -o OUTDIR, --outdir=OUTDIR
                        directory to save messages (default ./).
  -n, --new             get only new messages (exit on first already
                        downloaded thread). Use this if you want just to
                        update your archive.
  -d, --debug           show debug messages.
  -r, --raw             show raw server communications (works only in debug
                        mode).

All chat messages are downloaded to OUTDIR (or current directory) in .eml format. You can import them to your other e-mail account using e-mail client (let's say Thunderbird & ImportExportTools extension).

Use START if you want to skip newest threads. Gmail shows date in local time; so you have to pass TIMEZONE in order to have correct messages time (you can configure timezone using account settings).

Known issues

Language settings in gmail shouldn't affect requests or time format (but if it does, please contact me).

If you run get_chats.py several times during conversation you can get several messages with your conversation (because the message with conversation itself is changing after new message sent).

Program could download message several times (because time representation changes). But it just would overwrite file; so you don't have to worry about it. If you are using -n switch this wouldn't happen often.

Updated