skip to navigation
skip to content

pygmail2 0.2.3

Send mail from gmail using python

Latest Version: 0.3.7


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.


  • Python 3
  • pip3 for installation



git clone
cd pygmail
python3 install

You can copy the script to a folder in your $PATH, for example:

sudo cp bin/ /usr/local/bin/

Using pip:

From github:

pip3 install --upgrade git+

or from PyPI:

pip3 install --upgrade pygmail2

As far as I know pip will not take care of the script files in bin/.


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


From a interactive python shell or from any python file:

from pygmail2.Pygmail import Pygmail
Pygmail().send_mail('', 'hi, there', '<b>important stuff </b>')

Using the in shell -h
usage: A python script for sending emails from commandline using gmail
       [-h] [--subj SUBJ] [--body_file BODY_FILE] to_addr

positional arguments:
  to_addr               Recepient email address

optional arguments:
  -h, --help            show this help message and exit
  --subj SUBJ, -s SUBJ  Subject of the email
  --body_file BODY_FILE, -b BODY_FILE
  • Write up your mail body in the shell in a interactive fashion: -s hi_there
  • Pipe your mail body to the script:
echo "<b>hi, how are you?</b>" | -s hi_there
  • Load the mail body with a html file:
wget -O body.html -s hi_there -b body.html
File Type Py Version Uploaded on Size
pygmail2-0.2.3.tar.gz (md5) Source 2014-07-28 1KB