Skip to main content

Send mail from gmail using python

Project 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).


  • Python 3
  • pip3 for installation



git clone
cd pygmail
python3 install

Using pip:

From github:

pip3 install --upgrade git+

or from PyPI:

pip3 install --upgrade pygmail2


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


from pygmail2.Pygmail import mo
from pygmail2.Addr import ad
# send to one address = "", subject= "test", text = "<b>hi there</b>")
# send attachments = "", subject= "test", text = "<b>hi there</b>", attachments = ["/tmp/x.txt", "/tmp/y.png"])
# send to multiple addresses = ["", ""], subject= "test", text = "<b>hi there</b>", attachments = ["/tmp/x.txt", "/tmp/y.png"])
# use html file as mail body = ["", ""], 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 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