Skip to main content

Zope sendmail

Project description

zope.sendmail is a package for email sending from Zope 3 applications. Email sending from Zope 3 applications works as follows:

A Zope 3 application locates a mail delivery utility (IMailDelivery) and feeds a message to it. It gets back a unique message ID so it can keep track of the message by subscribing to IMailEvent events.

The utility registers with the transaction system to make sure the message is only sent when the transaction commits successfully. (Among other things this avoids duplicate messages on ConflictErrors.)

If the delivery utility is a IQueuedMailDelivery, it puts the message into a queue (a Maildir mailbox in the file system). A separate process or thread (IMailQueueProcessor) watches the queue and delivers messages asynchronously. Since the queue is located in the file system, it survives Zope restarts or crashes and the mail is not lost. The queue processor can implement batching to keep the server load low.

If the delivery utility is a IDirectMailDelivery, it delivers messages synchronously during the transaction commit. This is not a very good idea, as it makes the user wait. Note that transaction commits must not fail, but that is not a problem, because mail delivery problems dispatch an event instead of raising an exception.

However, there is a problem – sending events causes unknown code to be executed during the transaction commit phase. There should be a way to start a new transaction for event processing after this one is commited.

An IMailQueueProcessor or IDirectMailDelivery actually delivers the messages by using a mailer (IMailer) component that encapsulates the delivery process. There currently is only one mailer:

ISMTPMailer sends all messages to a relay host using SMTP.

If mail delivery succeeds, an IMailSentEvent is dispatched by the mailer. If mail delivery fails, no exceptions are raised, but an IMailErrorEvent is dispatched by the mailer.

Change history

3.5.1 (2009-01-26)

  • Copied over the UtilityTerm and UtilityVocabulary implementation from zope.app.component to avoid a dependency.

  • Work around a problem when smtp quit fails, the mail was considered not delivered where just the quit failed.

3.5.0 (2008-07-05)

  • final release (identical with 3.5.0b2)

3.5.0b2 (2007-12-19)

3.5.0b1 (2007-11-08)

  • Added README.txt

  • Can now talk to servers that don’t implement EHLO

  • Fix bug that caused files with very long names to be created

  • Fix for https://bugs.launchpad.net/zope3/+bug/157104: move aside mail that’s causing 5xx server responses.

3.5.0a2 (2007-10-23)

  • Cleaned up does_esmtp in faux SMTP connection classes provided by the tests.

  • If the QueueProcessorThread is asked to stop while sending messages, do so after sending the current message; previously if there were many, many messages to send, the thread could stick around for quite a while.

3.5.0a1 (2007-10-23)

  • QueueProcessorThread now accepts an optional parameter interval for defining how often to process the mail queue (default is 3 seconds)

  • Several QueueProcessorThreads (either in the same process, or multiple processes) can now deliver messages from a single maildir without duplicates being sent.

3.4.0 (2007-08-20)

  • Bugfix: Don’t keep open files around for every email message to be sent on transaction commit. People who try to send many emails in a single transaction now will not run out of file descriptors.

3.4.0a1 (2007-04-22)

Initial release as a separate project, corresponds to zope.sendmail from Zope 3.4.0a1.

Download files

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

Source Distribution

zope.sendmail-3.5.1.zip (42.3 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page