Skip to main content

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


Download files

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

Source Distribution

googlemail-0.1.0.tar.gz (3.1 kB view hashes)

Uploaded source

Built Distribution

googlemail-0.1.0-py3-none-any.whl (4.7 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page