root / tags / 1.0 / README.txt

Revision 1, 2.1 kB (checked in by amcgregor, 2 years ago)

Initial import of entire TurboMail tree.

Effectively a full transfer from our in-house Subversion server.
Includes past releases and trunk.

Line 
1To use Turbo-Mail you need to perform the following actions:
2
31. Add the following to the general section of your dev.cfg, prod.cfg or app.cfg: (the defaults are shown)
4
5        mail.on = True # Boolean; This must be enabled for any processing to take place.
6        mail.server = None # String; Required.
7        mail.username = None # String; If both username and password are not None authentication will be used.
8        mail.password = None # String
9        mail.sender = None # String; Used by the sample below to centralize sender e-mail address.
10        mail.debug = False # Boolean; Enabling this will output all communications between SMTP server and client.
11        mail.interval = 10 # Integer; Interval between queue checks in seconds.
12        mail.threads = 4 # Integer; Maximum number of concurrent threads.
13        mail.jobs = 10 # Integer; Maximum number of work units per thread.
14        mail.timeout = 60 # Integer; Time a thread will remain alive waiting for new work units in seconds.
15
162. At the location you wish to send e-mail:
17
18        0. Import TurboMail.
19
20                e.g.:
21                        import turbomail
22
23        1. Create an instance of a Message object.  Two are included: Message and TemplateMessage.
24       
25                e.g.:
26                        id = user.id
27                        message = turbomail.TemplateMessage(
28                                        turbogears.config.get("mail.sender", None),
29                                        user.email,
30                                        _("Welcome to the booking system."),
31                                        "myapp.templates.mail.welcome",
32                                        dict(employee=lambda: model.Employee.get(id))
33                                )
34       
35        2. Enqueue the message.
36       
37                e.g.:
38                        turbomail.enqueue(message)
39
40   Note that you can pass a callable as the value of arguments passed to KID by TemplateMessage.  These will be executed during initial message compilation - usually just before the message is sent.  This is important if you wish to pass SQLObject-based data to an e-mail template.  The example above gets around thread-based limitations by retrieving the record just before the template is evaluated.
41
42Lots of debugging information will be output - modify your logging rules to filter out the noise.  All loggers are prefixed with 'turbomail', with SMTP connection information using 'turbomail.dispatch', queue and thread pool management 'turbomail.pool'.
43
44Enjoy!
Note: See TracBrowser for help on using the browser.