On Wed, 2011-03-02 at 16:00 -0800, Alice Bevan–McGregor wrote: > On 2011-03-02 13:04:16 -0800, Daniel Holth said: > > > I'm not using pyramid_mailer (yet?) but I love the underlying Lamson > > library used to wrap Python's mail libraries. I just keep a > > lamson.server.Relay() around to send mail through the local mail server > > (no threadpool). Lamson is also a pretty cool way to receive e-mail. > > While I can't really comment on the quality of Lamson (it certainly > seems from the website like it contains many useful features), I could > find no trace of a OOP Message class for the construction of MIME > messages. Things like lamson.server.Relay().deliver() accept raw MIME > messages, with secondary methods (send/reply) to construct /extremely/ > limited messages for you. > > Threading (or multi-process) is also vital for delivery of mail in > response to user actions. You don't want your controller/view to wait > for an entire SMTP negotiation and delivery session, and repeatedly > opening and closing connections is terribly wasteful. (And can make > the difference between one customized message every two seconds to 150 > customized messages per second, which was what I last clocked TurboMail > at before MobileMe blacklisted my testing server. ;)
FTR, I don't much care what folks use (I hesitate to even post this, because the amount I care about this is so little). But it bears mentioning that pyramid_mailer is not just something that delivers mail immediately via SMTP. pyramid_mailer (or actually repoze.sendmail, on which it's based) has QueuedMailDelivery and the "qp" console script, e.g. the settings are defined in the config file: [app:myapp] # other settings mail.queue_path = /queue/path The config file settings are used to create a mailer in the application: mailer = pyramid_mailer.mailer_factory_from_settings(settings) Then the mailer is used in views: mailer.send_to_queue(message) # puts message into queue without delay (Note that even in this mode, the message won't actually be placed into the queue until the current transaction (as defined by the "transaction" module, usually bounded by the repoze.tm2 middleware or pyramid_tm) is committed.) The queue is eventually drained by repeated invocations of the "qp" script that is installed when pyramid_mailer is installed: $ qp [--options] /queue/path - C > > TurboMail does, in fact, make use of Python's built-in libraries to do > all of its work. The Message class simply takes all of the hassle of > managing Header, MIMEBase, MIMEImage, MIMEMultipart, MIMEText, > encode_base64, formatdate, make_msgid, and e-mail address formatting > out of the picture for developers utilizing it. You can have immediate > (non-threaded) delivery using the immediate "manager", threading using > the "ondemand" manager (with automatic load-based scaling of the worker > thread pool), and it would be fairly trivial to add local sendmail or > other non-SMTP transports. > > — Alice. > > -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
