Skip to main content

Send mail from gmail using python

Project description

Description

This is a very simple package that enables you to send mail through gmail using python. It’s not a big deal, it does not read your emails, no calendars, no drafts… It does just one thing, sending emails (possibly with attachments).

Requirements

  • Python 3

  • pip3 for installation

Install

Using setup.py

git clone https://github.com/kindlychung/pygmail.git
cd pygmail
python3 setup.py install

Using pip:

From github:

pip3 install --upgrade git+https://github.com/kindlychung/pygmail.git

or from PyPI:

pip3 install --upgrade pygmail2

Security

It uses smtp, that’s all. You can always check the source code, of course

Usage

from pygmail2.Pygmail import mo
from pygmail2.Addr import ad
# send to one address
mo.sm(to_addr = "xyz@example.com", subject= "test", text = "<b>hi there</b>")
# send attachments
mo.sm(to_addr = "xyz@example.com", subject= "test", text = "<b>hi there</b>", attachments = ["/tmp/x.txt", "/tmp/y.png"])
# send to multiple addresses
mo.sm(to_addr = ["xyz@example.com", "aaa@bbb.org"], subject= "test", text = "<b>hi there</b>", attachments = ["/tmp/x.txt", "/tmp/y.png"])
# use html file as mail body
mo.sm(to_addr = ["xyz@example.com", "aaa@bbb.org"], subject= "test", mailfile = "/tmp/x.html", attachments = ["/tmp/x.txt", "/tmp/y.png"])

Change log

  • single recipient and single attachment now don’t require using list

  • Enabled attachments

  • Email address autocompletion

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

pygmail2-0.2.6.tar.gz (2.3 kB view hashes)

Uploaded Source

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