- If you don't already have a Google account, sign up.
- If you have never created a Google APIs Console project, read the Managing Projects page and create a project in the Google API Console.
The Gmail API is a RESTful API that can be used to access Gmail mailboxes and send mail. All we need to use the Gmail API is the client library and an app that can authenticate as a Gmail user.
Above script uses OAuth 2.0 authentication.
Generate a client ID and client secret
Follow steps until you generate credentials.json
. Save this file in your project folder.
- run
py -m venv env
- run
.\env\Scripts\activate
- run
pip intall -r requirements.txt
- run
python auth.py"
- run
python script.py "reciver_email_address" "subject_of_mail" "message_of_mail"
- run
python3 -m venv venv
- run
source venv/bin/activate
- run
pip3 intall -r requirements.txt
- run
python auth.py"
- run
python script.py "reciver_email_address" "subject_of_mail" "message_of_mail"