TYPO3  7.6
Transport/SpoolTransport.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of SwiftMailer.
5  * (c) 2009 Fabien Potencier <fabien.potencier@gmail.com>
6  *
7  * For the full copyright and license information, please view the LICENSE
8  * file that was distributed with this source code.
9  */
10 
17 {
19  private $_spool;
20 
23 
27  public function __construct(Swift_Events_EventDispatcher $eventDispatcher, Swift_Spool $spool = null)
28  {
29  $this->_eventDispatcher = $eventDispatcher;
30  $this->_spool = $spool;
31  }
32 
40  public function setSpool(Swift_Spool $spool)
41  {
42  $this->_spool = $spool;
43 
44  return $this;
45  }
46 
52  public function getSpool()
53  {
54  return $this->_spool;
55  }
56 
62  public function isStarted()
63  {
64  return true;
65  }
66 
70  public function start()
71  {
72  }
73 
77  public function stop()
78  {
79  }
80 
89  public function send(Swift_Mime_Message $message, &$failedRecipients = null)
90  {
91  if ($evt = $this->_eventDispatcher->createSendEvent($this, $message)) {
92  $this->_eventDispatcher->dispatchEvent($evt, 'beforeSendPerformed');
93  if ($evt->bubbleCancelled()) {
94  return 0;
95  }
96  }
97 
98  $success = $this->_spool->queueMessage($message);
99 
100  if ($evt) {
102  $this->_eventDispatcher->dispatchEvent($evt, 'sendPerformed');
103  }
104 
105  return 1;
106  }
107 
114  {
115  $this->_eventDispatcher->bindEventListener($plugin);
116  }
117 }