Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Gmail client

Project description

Description

High-level interface for sending email through googlemail.

Usage

Create conf.py and fill in your email and password credentials. Ex:

email = 'your.email@gmail.com'
password = 'your.pass'   

Create googlemail object:

gmail = Gmail(email, password)

Start the server and login

gmail.start_server()
gmail.login()

Create a simple template dictionary with the email header and body

mail_template = {
    'from': 'fromsender@gmail.com',
    'to': 'tosender@gmail.com',
    'subject':  'Cool subject email',
    'body': """
    HTML template or the like
    """
}

Send the message

gmail.send_msg(mail_template)

Testing

To run the tests you need to configure the sender username, password, and recipient email

$ export GOOGLEMAIL_EMAIL=<YOUR SENDER EMAIL>
$ export GOOGLEMAIL_PASSWORD=<YOUR SENDER PASSWORD>

$ export GOOGLEMAIL_TESTEMAIL=<YOUR TEST RECIPIENT EMAIL>

Project details


Release history Release notifications

This version

0.1.0

Download files

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

Files for googlemail, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size googlemail-0.1.0-py3-none-any.whl (4.7 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size googlemail-0.1.0.tar.gz (3.1 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page