Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

It makes sending emails easier with Python.

Project Description

It makes sending mail easier. The main features:

  1. It allows you specify SMTP headers by keyword arguments.
  2. Support interactive prompt for username or password.
  3. Support optional with statement.


You can install it via PyPI,

sudo pip install postbox

or download it manually.


It is an example which sends a mail from Python Shell.

>>> from postbox import Postbox, Gmail

>>> gmail = Postbox(host='') # or gmail = Gmail()

>>>     gmail.send(
...             to = ['', ''],
...             bcc = '',
...             subject = 'Test from Python Shell',
...             body = 'It is used postbox to send. :)'
...     )

>>> gmail.close()

You can find more examples here.


The Postbox or Gmail accepts the following keyword arguments:

  1. host: the hostname of your SMTP server. ex. ‘’ or ‘’
  2. port: the port number of your SMTP server.
  3. user: the username.
  4. password: the password.
  5. tls: use tls or not.
  6. prompt_user: prompt string if you don’t specified user.
  7. prompt_password: prompt string if you don’t specified password.
  8. debuglevel: the debuglevel.
  9. dry_run: don’t send the mail out.

The all keyword arguments to send will be translated into SMTP headers, except the body is the body of this mail. If you don’t specify from_, it takes the username as default. The iterable but not string will be joined to a string by comma.

Release History

Release History

This version
History Node


Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
postbox-0.1.tar.gz (2.7 kB) Copy SHA256 Checksum SHA256 Source Jun 25, 2013

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting