TurboMail Documentation

TurboMail is a Python library to ease sending emails from your application.

By using TurboMail you can:

  • Easily construct plain text and HTML emails
  • Make your code which sends mails testable
  • Use different mail delivery strategies (e.g. your app should not block if your mail server is slow)
  • Switch the transport (e.g. SMTP, mailbox) by just changing some values in a config file

TurboMail 3.x was rebuilt from scratch so that you don’t have dependencies on TurboGears any longer. Therefore TurboMail is usable with all Python applications including Django, Pylons, Trac, web.py and plain CGI scripts. All versions of Python 2.3-2.6 are supported and there are no other dependencies on external packages for normal operation [1].

Using TurboMail is meant to be simple:

from turbomail import Message
message = Message("from@example.com", "to@example.com", "Hello World")
message.plain = "TurboMail is really easy to use."

This would send a plain text email with the subject “Hello World” and the author (From: header) “from@example.com” to “to@example.com“. The body just contains “TurboMail is really easy to use.”. The code assumes that you use TurboMail inside of a “supported” framework [2] which sets up TurboMail on startup. We’ll show you how to start TurboMail manually (e.g. for plain CGI scripts) later (see TurboMail from Scratch).

This documentation is an effort of the TurboMail developers to show you the full potential of TurboMail. But we need your help! If you find mistakes in this docs, please notify us. If you think some parts should be clarified or documented differently, please notify us. We really need your input (and your time :-) to make TurboMail a software everyone likes to use.

[1]In order to run the full test suite you need to install pymta and its dependencies.
[2]TurboMail 3 comes with adapters for TurboGears 1 and Pylons/TurboGears 2 (see TurboMail Adapters) but supporting a new framework should only be a matter of 4-10 lines of code if the framework uses setuptools (see Writing Custom Adapters for more information).