XOOPS RMCommon Utilities  2.1.8.91RC
 All Classes Namespaces Files Functions Variables
ReporterPlugin.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of SwiftMailer.
5  * (c) 2004-2009 Chris Corbyn
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 //@require 'Swift/Events/SendListener.php';
12 //@require 'Swift/Events/SendEvent.php';
13 //@require 'Swift/Plugins/Reporter.php';
14 
22  implements Swift_Events_SendListener
23 {
24 
30  private $_reporter;
31 
36  public function __construct(Swift_Plugins_Reporter $reporter)
37  {
38  $this->_reporter = $reporter;
39  }
40 
45  {
46  }
47 
52  public function sendPerformed(Swift_Events_SendEvent $evt)
53  {
54  $message = $evt->getMessage();
55  $failures = array_flip($evt->getFailedRecipients());
56  foreach ((array) $message->getTo() as $address => $null)
57  {
58  $this->_reporter->notify(
59  $message, $address, (array_key_exists($address, $failures)
62  );
63  }
64  foreach ((array) $message->getCc() as $address => $null)
65  {
66  $this->_reporter->notify(
67  $message, $address, (array_key_exists($address, $failures)
70  );
71  }
72  foreach ((array) $message->getBcc() as $address => $null)
73  {
74  $this->_reporter->notify(
75  $message, $address, (array_key_exists($address, $failures)
78  );
79  }
80  }
81 
82 }