Skip to content

A simple python script that emails files from a Google Drive folder

Notifications You must be signed in to change notification settings

cbasah/gdrive-to-email

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

GDrive-to-Email

This simple Python script checks a Google Drive folder for files matching a given MIME-type, sends an e-mail with each file as an attachment and moves the file to another Google Drive folder after the e-mail is sent.

Installation

Use the package manager pip to install foobar.

pip install -r requirements.txt

Create a Google Cloud service account and generate the JSON credentials file (e.g. credentials.json). Store the credentials file at the root folder of this project.

Generate .env file with the following environment variables. The following values are just examples.

CREDENTIAL_FILENAME = "credentials.json"
MIME_MAIN_TYPE = "application"
MIME_SUB_TYPE = "pdf"
SENT_GDRIVE_FOLDER_ID = "1NMsA0ssdw2q3jVD1OMwhaaansNO2mzxxx"
UNSENT_GDRIVE_FOLDER_ID = "1A9l0jRnd415c2h4fpBy57333tiRuHzzz"
SENDER_EMAIL = "[email protected]"
RECEIVER_EMAIL = "[email protected]"
SMTP_SERVER_HOSTNAME = "smtp.gmail.com"
SMTP_SERVER_TLS_PORT = 587
SMTP_SERVER_SENDER_PASSWORD = "abcd efgh ijkl mnop"

PRs are welcomed!

About

A simple python script that emails files from a Google Drive folder

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages