Inspired by fetchmail, this allows you to fetch your mail from Gmail using the Google Gmail API.
- Perl
- module Data::Dumper
- module Google::API::Client
- module Google::API::OAuth2::Client
- module MIME::Base64::URLSafe
- module Config::Simple
- module Storable
- module Crypt::CBC
- module IO::Prompter
- module Getopt::Long
- module Net::Server::Daemonize
- module File::Basename
- module File::Monitor
- module IO::Pager
- module Crypt::OpenSSL::AES
- ps
- Go to https://console.developers.google.com/apis
- Create a project. Project name: fetchgmail
- Credentials -> Create credentials -> OAuth client ID -> Other
- Dashboard -> ENABLE API -> Gmail API -> ENABLE
./fetchgmail.pl
vi ~/.fetchmailrc
./fetchgmail.pl
./fetchgmail.pl -f /path/to/fetchmailrc
./fetchgmail.pl --quit
./fetchgmail.pl -s
./fetchgmail.pl -l
./fetchgmail.pl -m AGE
Remove seen msgid older than AGE. AGE format is [integer][h|d|m|y] (hour|day|month|year), eg 1m
./fetchgmail.pl -i 1234567890abcdef
./fetchgmail.pl -p mysuperawesomepassphrase
Default configuration file is ~/.fetchgmailrc, but you may specify it as an argument.
fetchgmail will detect config file changes and apply them on the next run. This does not include clientid nor clientsecret, which will require a full restart.
- What to pipe each mail to
- API client ID
- API client secret
- Where to save google token
- Encrypted token passphrase (It's safer to not enable this option)
- Message ID cache
- Path to pidfile
- Path to logfile
- How mail will be fetched
- Do partial sync + msgid
- This will do a partial sync from the previous history id and also check our local msgid file to prevent dupes
- If there is no partial sync, it will do a full sync with msgid checking
- Do full sync + msgid
- This will do a full sync of all mail newer than the "newer" value, and also check our local msgid file to prevent dupes
- Do full sync
- This will do a full sync of all mail newer than the "newer" value
- Fetch all mail newer than date (1h 2d 3m 4y) (Default: all)
- Labels to sync from (space delimited, single quote if multiple words)
- Note: multiple (repeated) labelIds do not currently work, so will only take a single entry. Maybe try to patch the module later.
- Additional filters. Use gmail search operators. Default is none.
- daemon mode: Poll every x number of seconds. Default is 0, which means it only runs once.