This script downloads all attachments from Google Mail (Gmail) Emails for a given query.
git clone https://github.com/isleshocky77/google-mail-attachment-downloader.git
cd google-mail-attachment-downloader
composer install
You must create a Google Cloud Application, get the credentials and place them at auth/credentials.json
.
On first run it will ask you to go a url to authorize the application with instructions.
./bin/console -vvv gmail-file-downloader:download-attachments --query="label:emails-i-need"
# Multiple query criteria
./bin/console -vvv gmail-file-downloader:download-attachments --query="label:emails-i-need" --query="from:john@example.org"
The verbose email will print out page numbers with a page token. If you need to stop or there is an error you can pick up where it left with the following
./bin/console -vvv gmail-file-downloader:download-attachments --query="label:emails-i-need" --starting-page-token=06638643197320647210
./bin/php-cs-fixer fix
./bin/phpstan
./bin/phpmd src/ text phpmd.xml.dist
./bin/psalm --show-info=true