All implementations of specific behaviours (e.g. managers) can be built using TurboMail extensions. The basic extension interface provided by TurboMail is very simple and takes care of basic life-cycle management:
Every extension instance is started and stopped only once. This is being guaranteed by the super class so you must call super() for all overridden methods!
Every manager has a method get_new_transport() which can be used to get a new transport instance ready to deliver messages. The manager is responsible to manager the lifecycle of the returned transport instance so it needs to call the stop() method when the transport is not used any more (e.g. the manager’s stop() method was called or the manager wants to replace the existing transport instance with a new transport.
managers must be thread safe
Interface
turbomail.api.Transport
deliver(message) stop()
transports don’t have to be thread safe
Every HTML email should have a plain text part. If you really need produce nice text emails, you should build the plain text part by hand, the same way you do with the HTML part. But sometimes you just need a text part without much work (this is especially true if your mails’ contents do change frequently).
There are quite a few, very nice HTML-to-text libraries in the Python space but we did not feel comfortable including one of them in TurboMail due to licensing restrictions (TurboMail should be usable under the MIT license), additional requirements (TurboMail itself should have as few external dependencies as possible and some of those converters requires quite a few packages for themselves) and maintenance (we don’t want to ship a private copies of external libraries which we have to keep secure and up-to-date).
If you are using templates, like Genshi, for your e-mail, the template engine may provide a way to create a plain text version automatically.
TagStripper is meant to be the simplest implementation of an html to text converter that is of any use: It just strips the tags from the HTML but does not touch the contents (so it does not care about HTML entities like ) at all. The only exception to this rule are script, header and style tags - TagStripper will cut the contents of these tags too because usually they don’t contain any information which is useful for plain text messages.
adapters must be thread safe, stop and start can be called multiple times, should not make any difference