[ Index ] |
MailPress 7.2 |
[ Index ] [ Classes ] [ Functions ] [ Variables ] [ Constants ] [ Statistics ] |
[Summary view] [Print] [Text view]
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 11 /** 12 * Stores Messages in a queue. 13 * 14 * @author Fabien Potencier 15 */ 16 class Swift_Transport_SpoolTransport implements Swift_Transport 17 { 18 /** The spool instance */ 19 private $spool; 20 21 /** The event dispatcher from the plugin API */ 22 private $eventDispatcher; 23 24 /** 25 * Constructor. 26 */ 27 public function __construct(Swift_Events_EventDispatcher $eventDispatcher, Swift_Spool $spool = null) 28 { 29 $this->eventDispatcher = $eventDispatcher; 30 $this->spool = $spool; 31 } 32 33 /** 34 * Sets the spool object. 35 * 36 * @return $this 37 */ 38 public function setSpool(Swift_Spool $spool) 39 { 40 $this->spool = $spool; 41 42 return $this; 43 } 44 45 /** 46 * Get the spool object. 47 * 48 * @return Swift_Spool 49 */ 50 public function getSpool() 51 { 52 return $this->spool; 53 } 54 55 /** 56 * Tests if this Transport mechanism has started. 57 * 58 * @return bool 59 */ 60 public function isStarted() 61 { 62 return true; 63 } 64 65 /** 66 * Starts this Transport mechanism. 67 */ 68 public function start() 69 { 70 } 71 72 /** 73 * Stops this Transport mechanism. 74 */ 75 public function stop() 76 { 77 } 78 79 /** 80 * {@inheritdoc} 81 */ 82 public function ping() 83 { 84 return true; 85 } 86 87 /** 88 * Sends the given message. 89 * 90 * @param string[] $failedRecipients An array of failures by-reference 91 * 92 * @return int The number of sent e-mail's 93 */ 94 public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null) 95 { 96 if ($evt = $this->eventDispatcher->createSendEvent($this, $message)) { 97 $this->eventDispatcher->dispatchEvent($evt, 'beforeSendPerformed'); 98 if ($evt->bubbleCancelled()) { 99 return 0; 100 } 101 } 102 103 $success = $this->spool->queueMessage($message); 104 105 if ($evt) { 106 $evt->setResult($success ? Swift_Events_SendEvent::RESULT_SPOOLED : Swift_Events_SendEvent::RESULT_FAILED); 107 $this->eventDispatcher->dispatchEvent($evt, 'sendPerformed'); 108 } 109 110 return 1; 111 } 112 113 /** 114 * Register a plugin. 115 */ 116 public function registerPlugin(Swift_Events_EventListener $plugin) 117 { 118 $this->eventDispatcher->bindEventListener($plugin); 119 } 120 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Tue May 19 15:55:14 2020 | Cross-referenced by PHPXref 0.7.1 |