Skip to content

Latest commit

 

History

History

Send_Email_Using_Gmail_Api

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Getting Started With Google Api

  1. If you don't already have a Google account, sign up.
  2. If you have never created a Google APIs Console project, read the Managing Projects page and create a project in the Google API Console.

Gmail Api

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.

Setup

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 Script On Windows

  1. run py -m venv env
  2. run .\env\Scripts\activate
  3. run pip intall -r requirements.txt
  4. run python auth.py"
  5. run python script.py "reciver_email_address" "subject_of_mail" "message_of_mail"

Run Script On macOS and Linux

  1. run python3 -m venv venv
  2. run source venv/bin/activate
  3. run pip3 intall -r requirements.txt
  4. run python auth.py"
  5. run python script.py "reciver_email_address" "subject_of_mail" "message_of_mail"

Console: Terminal: