Skip to main content

My Gmail API Wrapper

Project description

JT_Gmail

This is a simple interface for programmatically sending emails using the Gmail API. I typically import it as

To get started you must create a project and enable the Gmail API, create OAuth2 credentials and download them in a json file.

Before you can use this module for the first time, you must run:

import JT_Gmail as gmail

gmail.GetToken('scope1', 'scope2', ..., email_address='user@gmail.com', cred_path="path_to_your_credentials.json")

Supply the scopes you plan on using as *args. A list of all the scopes can be found here.

This will prompt for authentication and generate the proper token to use the scopes you supplied. The token and credentials are saved for later use, so you might only have to run that line once. As you perform actions, if they need new permissions, they will be requested. Authentication will be required for each gmail user you wish to use.

To send emails, it's as easy as:

import JT_Gmail as gmail

with open("email.html") as file:
    gmail.SendHTMLEmail(
        sender='sender@gmail.com', 
        to="recipient@some.website", 
        subject="Example Email", 
        message_html=file.read()
)

This was base heavily on code snippets supplied by Google.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

JT_Gmail-0.0.3.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

JT_Gmail-0.0.3-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file JT_Gmail-0.0.3.tar.gz.

File metadata

  • Download URL: JT_Gmail-0.0.3.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7

File hashes

Hashes for JT_Gmail-0.0.3.tar.gz
Algorithm Hash digest
SHA256 e6512f88b3e4105c9069de9e4324b3a91f81ce14e7143cb395cce1e32b234e85
MD5 e41dec4fabab76dcd8c84a3dc34edbdc
BLAKE2b-256 f9ce33e510a647e546c24c590c3f6b6ede02b20e95f50ca660f2fcfe44d464aa

See more details on using hashes here.

File details

Details for the file JT_Gmail-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: JT_Gmail-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7

File hashes

Hashes for JT_Gmail-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3bca32efb69cb6b5d864015a300efae25880d78df8d464cc11df7d83d8659981
MD5 56993aaf5088acb9fd026edc355b7815
BLAKE2b-256 914571c37a2bfc931fab17aa21c696ec745f61f756ff507dc66247cf79236dfd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page