Added by Simon Mundy, last edited by Alexander Veremyev on Jun 02, 2008  (view change) show comment

Labels

 
(None)

Zend Framework: Zend_Mail_Transport_Queue Component Proposal

Proposed Component Name Zend_Mail_Transport_Queue
Developer Notes http://framework.zend.com/wiki/display/ZFDEV/Zend_Mail_Transport_Queue
Proposers
Revision 0.1 - 1 October 2007: Initial proposal. (wiki revision: 3)

Table of Contents

1. Overview

Zend_Mail_Transport_Queue is designed to manage the delivery of a large volume of mail. It provides a number of backends by which to store the mail and then allows deferred delivery from the storage container using concrete transport methods from a separate script.

2. References

3. Component Requirements, Constraints, and Acceptance Criteria

  • This component will provide an interface to allow the creation of multiple backends.
  • This component will not send mail after a developer-specified amount of retries.
  • This component will allow the developer to pass any valid transport component to re-send mail.
  • This component will provide a means for passing log instances.

4. Dependencies on Other Framework Components

  • Zend_Mail
  • Zend_Mail_Transport_Abstract

5. Theory of Operation

This transport type replaces an existing SMTP or Sendmail transport instance. A concrete storage adapter is instantiated (e.g. Zend_Mail_Transport_Queue_Db or Zend_Mail_Transport_Queue_File) and then used as the transport to dispatch mail in the usual manner.

A secondary script (run as a cron job, scheduled task or as a trigger during another script's execution) will then access the transport's static process method. During this time mail is processed and directed to a specified transport (e.g. SMTP or Sendmail) and sent as normal. Processing will be limited to an amount configurable by the developer. If a mail instance cannot be sent (i.e. throws a Zend_Mail_Transport_Exception or Zend_Mail_Protocol_Exception exception) the mail will be requeued for a specified amount of retries (default is 10).

When mail is processed (success or failure) Zend_Mail_Transport_Queue will also log the attempt if a Zend_Log adapter is made available. The content and format of the log message is also developer-configurable.

6. Milestones / Tasks

  • Milestone 1: design notes will be published here
  • Milestone 2: Working prototype checked into the incubator supporting use cases #1, #2, ...
  • Milestone 3: Working prototype checked into the incubator supporting use cases #3 and #4.
  • Milestone 4: Unit tests exist, work, and are checked into SVN.
  • Milestone 5: Initial documentation exists.

7. Class Index

  • Zend_Mail_Transport_Queue_Interface
  • Zend_Mail_Transport_Queue_Abstract
  • Zend_Mail_Transport_Queue_Db
  • Zend_Mail_Transport_Queue_File

8. Use Cases

9. Class Skeletons

Zend Comments

This proposal has been accepted for development in the standard incubator as-is.

Very nice! Exactly the thing i was searching for. Will it be provided with ZF 1.7?
Kind regards, Dennis.

Great idea!

Perhaps this should be a subclass to a Zend_Queue class, or simply a Zend_Queue where this functionality easily can be achieved.

Queues could probably be useful for other things such as file manipulation, PDF creation, and others.

Just a thought.